insert value usestate code example
Example 1: React Hooks append state
setTheArray(currentArray => [...currentArray, newElement])
Example 2: prevstate in usestate
const [prevState, setState] = React.useState([]);
setState(prevState => [...prevState, 'somedata'] );