You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Provide a method to reset history to initial value. It can also reset to a new initial history and at the same time, can be used to set a new initial value.
Imagine a game board, the user can restart (reset) or the user can change some board config, and we can reset to a new initial board value.
Describe the solution you'd like
const[state,setState,{ reset }]=useStateWithHistory('initial');setState('one');// state is now 'one', history is ['initial', 'one'], position is 1// reset to initialreset();// state is now 'initial', history is ['initial'], position is 0setState('two');// state is now 'two', history is ['initial', 'two'], position is 1reset(['one','two','three']);// state is now 'three', history is ['one', 'two', 'three'], position is 2
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Provide a method to reset history to initial value. It can also reset to a new initial history and at the same time, can be used to set a new initial value.
Imagine a game board, the user can restart (reset) or the user can change some board config, and we can reset to a new initial board value.
Describe the solution you'd like
The text was updated successfully, but these errors were encountered: