Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 327 Bytes

README.md

File metadata and controls

21 lines (17 loc) · 327 Bytes

immutable-component

immutable-component to make state immutable

Usage

this.setState({
    'a.b': 1
})
// or 
this.setState(prevState => {
    prevState.a.b = 1
})

// Either return a new value *or* modify the draft
this.setState(prevState => {
    // prevState.a.b.c = 1
    return { a: { b: 1 } }
})