A fast, dependency-free state container with easy copy and automagically memoized getters, designed for immutability.
Extra power
Wanna reduce Redux boilerplate? Use it combined with Actionware lib.
Install it
npm i stateware --save
yarn add stateware
Use it
const initialState = // Create a new state, updating 'users' valueconst newState = initialState // Access state valuesnewStateusersnewStategenderFilternewStatefilteredUsersnewStatetotalPosts
Usage with Redux
Do this:
Instead of:
switch (action.type) {
case 'SET_GENDER_FILTER':
const filter = action.payload
return {
...state,
genderFilter: filter,
filteredUsers: state.users.filter(user => !filter || user.gender === filter)
}
}
License
MIT © Wellington Guimaraes