history
history copied to clipboard
Why `history.length` is gone?
I'm migrating from react-router-domv5 to v6, and encountered that history.length
is no longer supported in history v5. In this situation, I have several questions.
- Why
history.length
is gone? Is there some contexts related to about this? - How can I replace this feature? (= substitution..?)
I looked for lots of channels(SO, RRD github issue, history github issue, googling etc...) but couldn't find out the reason and solution. Thanks for your reading.
Doesn't seem to be mentioned in the changelog, but yeah that's surprising.
Use window.history.length
Thanks for the tip but that won't help when the chosen history type is MemoryHistory
.
I think this change should be mentioned in docs. Additionally, if you use unstable_HistoryRouter
in version 6.3, you can use window.history.length
probably.
how to get history.length ?
react-router-dom: 6.14.2
and createBrowserRouter
Does anyone know how to know history.length?
There's been a PR open for this for two years. It's adds 4 lines of code and reverts an undocumented change. My perception is that the maintainers just don't care. You're on your own. I waited hopefully for a long time.
I won't ever use this library for future projects.