Pushing To React State Array
Solution 1:
// Create a new array based on current state:
let floors = [...this.state.floors];
// Add item to it
floors.push({ value: floorName });
// Set state
this.setState({ floors });
Solution 2:
For now, the best possible and simplest way is
this.setState(previousState => ({
floors: [...previousState.floors, {"value": value.floorName}]
}));
Solution 3:
In hooks form u may use
setState((prevVals) => [...prevVals,newVals])