Open pklicnik opened 8 years ago
+1 this request
In v3.1.0, I've exposed the history
object as the second argument in the function that we supply to the boot call. Do you have any specific use case wherin you would create the history object and give it to react-engine?
Thanks @samsel. We just need access to the history object, so the solution you've implemented works for me
@samsel I am looking to create my own history object to use scroll-behavior. Right now I don't see a way to be able to do that. I currently have edited the client.js to make history: useScrollToTop(createBrowserHistory)()
, but I'd prefer not to edit the library. Thoughts?
@epitaphmike are you looking to feed in your own history object?
@samsel Yes. Unfortunately react-router currently doesn't support resetting of the scroll position of the page change or with anchored links. scroll-behavior handles these changes nicely. In order to maintain the history, I'd need to pass in the history object from scroll-behavior.
@epitaphmike I've added support for custom history object - https://github.com/paypal/react-engine/pull/145
Thanks. Your change was exactly what I did locally. I guess I could have just submitted a pull request. I appreciate the update. Thank you again.
It seems this has yet to be added to npm. Just wanted to give you a heads up. Thanks again
@samsel Disregard my last comment. I see your pull request has yet to be merged as well. Thanks again
@epitaphmike its published now :)
Since react-router 3.0, a history object is automatically created when the client is mounted:
Consumers may need access to this history, so either allow users to provide a history object (via 'options' params) or provide a mechanism for consumers to access it.