Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Spread operating reducer state includes reducers in the state. #22

Closed
quisido opened this issue Nov 21, 2018 · 0 comments
Closed

Spread operating reducer state includes reducers in the state. #22

quisido opened this issue Nov 21, 2018 · 0 comments
Assignees
Labels
feature A new feature is requested.
Milestone

Comments

@quisido
Copy link
Collaborator

quisido commented Nov 21, 2018

addReducer('name', global => ({
  ...global, // reducers are now in the state
  newKey: 'new value'
}));

Best practice is to not spread operate the root, because there is no need to. This may not be intuitive to Redux users, so I'd like to support spread operating as a "backwards compatible" syntax, despite it being unnecessary.

I am pretty sold on the idea of having reducers available inside reducers.

Current fix is to silently ignore attempts to set state properties that share a name with reducers.

@quisido quisido self-assigned this Nov 21, 2018
@quisido quisido added the feature A new feature is requested. label Nov 21, 2018
@quisido quisido added this to the 0.1.2 milestone Nov 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature A new feature is requested.
Projects
None yet
Development

No branches or pull requests

1 participant