Last active
July 31, 2019 01:37
-
-
Save wattlebird/b19ebf85452f5f60967f653fe1d5bf15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeProblematicComponent extends React.Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| data = [...props.data] | |
| } | |
| } | |
| onChange = (arg) => { | |
| this.setState(prev => { | |
| const data = [...prev.data] | |
| return {data: data.map(itm => {...itm, a:arg})} | |
| } | |
| } | |
| render() { | |
| // it would call onChange somewhere | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment