you can probably give up these ( mobx
, redux
).
local state can be implemented with state
.
global, such as login information, topics, etc., can be implemented
with
context
.
The
question says that "each field needs to add a change method", which can be implemented in the following ways
//
set = (type) => (ev) => {
this.setState({
[type]:ev.target.value
})
}
//...
<input onchange={this.set('name')} />
<input onchange={this.set('age')} />
<input onchange={this.set('loaction')} />
<input onchange={this.set('company')} />
....