Created
February 15, 2021 13:41
-
-
Save ZakharDay/6b21c9435f62c16bb5d7d85845c3a950 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
export default class Container extends Component { | |
constructor(props) { | |
super(props) | |
} | |
handleOnChangeText (id, value) => { | |
let nextSettings = [] | |
this.state.settings.forEach(setting => { | |
if (setting.name == id) { | |
let nextSetting = { | |
name: setting.name, | |
value: value | |
} | |
nextSettings.push(nextSetting) | |
} else { | |
nextSettings.push(setting) | |
} | |
}) | |
this.setState({ | |
setting: nextSettings | |
}) | |
} | |
render() { | |
return <Button id={id} handleClick={this.handleClick} /> | |
} | |
} | |
export default class Input extends PureComponent { | |
constructor(props) { | |
super(props) | |
} | |
render() { | |
const { id, text, handleOnChangeText } = this.props | |
return <input onChangeText={() => handleOnChangeText(id, value)} value={text} /> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment