easy-react-state
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "easy-react-state", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Fun to use state management library for your awesome React app", | ||
@@ -5,0 +5,0 @@ "author": "ombori", |
@@ -194,6 +194,6 @@ # easy-react-state | ||
```tsx | ||
setter(...args: any[]): void | ||
setter(...args: any[]): S | ||
``` | ||
An object which holds functions which we can use to update the state. | ||
An object which holds functions which we can use to update the state. `easy-react-state` uses the amazing [immerjs](https://github.com/immerjs/immer). When updating a state, you can use mutator syntax like `state.name = 'zion'` for ease. Every setter must return the mutated state or new value. Internally, the state gets mutated inside the `setter` is a `draftState` created by immer. Then immer will create a new object based on the value, either `draftState` or new value, returned by `setter` leaving the `originalState` untouchable. | ||
@@ -200,0 +200,0 @@ ## Cons |
244915