-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reducers: add default handler #241
Conversation
Hi, do you have any news on this? I need this desperately. @piotrwitek could you please merge this? |
lol - i need this too! |
@@ -7,10 +7,12 @@ import { getType } from './get-type'; | |||
const add = createAction('ADD')<number>(); | |||
const increment = createAction('INCREMENT')(); | |||
const decrement = createAction('DECREMENT')(); | |||
const reduxInit = createAction('@@redux/INIT.1')(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reduxInit cannot be handled as it is implementation details of Redux not a public API, so please remove completely
```ts | ||
const counterReducer = createReducer(0) | ||
.handleAction(add, (state, action) => state + action.payload) | ||
.defaultHandler((state, action) => state = 0, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because reduxInit cannot be handled as it is implementation details of Redux and not a public API, second parameter is not necessary, it should be always invoked by initialization and should be handled in the user code as needed
@piotrwitek |
closed because it's stale |
Description
Adds a defaultHandler for reducers
Related issues:
Checklist
For bugfixes:
For new features:
dts-jest
dts-jest
IssueHunt Summary
Referenced issues
This pull request has been submitted to: