We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 333656c commit ceb2c60Copy full SHA for ceb2c60
content/docs/hooks-reference.md
@@ -190,6 +190,10 @@ function reducer(state, action) {
190
return {count: state.count + 1};
191
case 'decrement':
192
return {count: state.count - 1};
193
+ default:
194
+ // A reducer must always return a valid state.
195
+ // Alternatively you can throw an error if an invalid action is dispatched.
196
+ return state;
197
}
198
199
@@ -223,6 +227,10 @@ function reducer(state, action) {
223
227
224
228
225
229
230
231
232
233
226
234
235
236
0 commit comments