Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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