streamich / react-use

React Hooks — 👍
http://streamich.github.io/react-use
The Unlicense
42k stars 3.16k forks source link

fix: fixed useStateWithHistory issue with history state being a function after running history.back #2572

Open akdlsz21 opened 4 months ago

akdlsz21 commented 4 months ago

Description

useStateWithHistory had an issue when the initialState is a function. The back function breaks due to the history's first value remaining as a function.

I fixed this so the resolved value to be stored in history.

fixes #2568

Type of change

Checklist