react-update
Make setState easily and immutably.
So, why not use immutability-helper?
- No need to call setState manually
- No need to build syntactic sugar like
{x: {y: {$set: 1}}}
, just passx.y
and1
Installation
npm i --save react-update
Todo Demo
{ super thisupdate = update thisstate = text: '' items: } { const text items = thisstate const update = thisupdate return <div> <input type="text" value=text onChange= /> <button onClick= >Add</button> <ul> items </ul> </div> }
API
Bind component and execute setState automatically
{ super thisupdate = update thisstate = name: 'John' relation: family: 0 friend: 1 honor: '1' '2' '3' } { this this this this this // ['1', '2', '3', '4'] this // ['2', '3', '4'] // All above actions just render once and all state has changed. }
Silent usage
const myData = x: y: 0const newData = console // {x: {y: 1}}
Changelog
v0.4.0
2016-10-26
- Remove console info when state change.
- Add silent usage which would not execute setState automatically.
const myData = x: y: 1const newData = console // {x: {y: 2}}