Created
June 30, 2017 12:02
-
-
Save du5rte/5e2586be70c72007fefb174cbb64820d to your computer and use it in GitHub Desktop.
This file contains 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
import React, { Component } from "react"; | |
import _ from "lodash"; | |
export default class Example extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
uid: "", | |
displayname: "", | |
currency: { | |
uid: "coins", | |
displayname: "Coins", | |
rate: 1, | |
precision: 0 | |
} | |
}; | |
} | |
handleChange(e) { | |
const { name, value } = e.target; | |
const newState = _.set(this.state, name, value); | |
this.setState(newState); | |
} | |
render() { | |
return ( | |
<View> | |
<input | |
type="text" | |
name="currency.uid" | |
value={_.get(this.state, "currency.uid")} | |
onChange={this.handleChange.bind(this)} | |
/> | |
</View> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment