Reputation:
this is my initial state
const [state, setState] = React.useState({ fleet: {makeId: 867,....}, });
onChange I need to update the makeId.
setState({...state, ?})
How can I achieve this?
Upvotes: 0
Views: 64
Reputation: 5064
You can write something like this,
setState({...state, fleet: {...state.fleet, makeId: YourMakeId });
That should do the trick.
Upvotes: 4