hooks
hooks copied to clipboard
useUrlState doesn't delete initialState when state is set to undefined
In relation to #890
When trying to delete a state, the state will always go back to its initial state
Steps to reproduce
- Use the hook with an initial state
const [state, setState] = useUrlState({
someState: 'Initial State
})
- Try to delete said state:
setState({someState: undefined});
Expected:
-
someStateis not anymore
Actual:
- state is:
{someState: 'Initial State'}
看文档的描述,其实删除就是还原,不知道是不是这个描述有问题?需要确认,是还原成默认值还是彻底删除。