We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7a6e9e commit 862dfccCopy full SHA for 862dfcc
src/reworm.tsx
@@ -60,8 +60,9 @@ export class Provider extends Component {
60
}
61
62
private handleUpdate = (id: string, next: any) => {
63
- const nextState = typeof next === 'function' ? next(this.state) : next
64
- this.setState({ [id]: nextState })
+ this.setState((prevState: any) => ({
+ [id]: typeof next === 'function' ? next(prevState[id]) : next,
65
+ }))
66
67
68
0 commit comments