Implement a function useStateWithReset(initialValue) that behaves like a normal state handler but provides an additional reset function.
The function should:
value: current state value.setValue: function to update the state.reset: function to reset the state back to the initial value.Example
const state = useStateWithReset(5); state.value; // 5 state.setValue(10); state.value; // 10 state.reset(); state.value; // 5
JavaScript Function
No test results yet
Click "Run" to execute tests