how to update state using usestate inside a function code example
Example: update state in useState hook
// declare state using useState hook.
// someState is set to someInitialState
const [someState, setSomeState] = useState(someInitialState);
// setSomeState updates the current state
setSomeState(someOtherState);