History: Are there any plans to support history location state clearing?

Created on 6 Jan 2021  路  4Comments  路  Source: ReactTraining/history

Are there any plans to support history location state clearing?

Sometimes we use history.location.state to pass "temporary state". When finished using, it should be cleaned up immediately. As far as I know, there is NO API to clear the location state, and the only workaround is:

history.replace(currentPath, undefined);

I don't want to argue about where the "temporary state" should be kept, that's a different issue. Adding a history API to clear history.location.state sounds reasonable.

Thanks 馃檪

Most helpful comment

Oh cool, I can transfer these now. Sorry, just learning the new features (which I think is over a year old, so "new")

All 4 comments

This would be a question for the history library: https://github.com/ReactTraining/history

Oh cool, I can transfer these now. Sorry, just learning the new features (which I think is over a year old, so "new")

This would be a question for the history library: https://github.com/ReactTraining/history

Yes, you are right, my bad.

Oh cool, I can transfer these now. Sorry, just learning the new features (which I think is over a year old, so "new")

Thank you, Tim 馃槃

Was this page helpful?
0 / 5 - 0 ratings