Skip to content

Instantly share code, notes, and snippets.

@ZakharDay
Created February 15, 2021 13:41
Show Gist options
  • Save ZakharDay/6b21c9435f62c16bb5d7d85845c3a950 to your computer and use it in GitHub Desktop.
Save ZakharDay/6b21c9435f62c16bb5d7d85845c3a950 to your computer and use it in GitHub Desktop.
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