Closed idolize closed 9 years ago
Updated. Thanks for looking :smile:
Ha sure :) Now that I thought a bit more about it, would you be on board to change useReplaceWith
just to replace
? useReplaceWith
feels very verbose. And it contains the actual method name, which I don't really like since in react-router 1.0 we will most likely have to use a history
instance - which would have a different method to call.
Up to you.
Personally, I like useReplaceWith
because it maps so clearly to the react-router
API, which makes it more obvious for people who already know react-router
(anywhere they see it in the code they can almost immediately figure "oh, this is the same as router.replaceWith
. Got it.").
But on the other hand, if you want a very future-proof API and you think react-router
is likely to change this naming anyway, then perhaps replace
is better as it is less "coupled".
@idolize I'd like to go with just replace
- an explanation in the docs would most likely suffice. Would you be up to changing it, so we can get this merged in? :)
Sure thing! I updated the PR.
BTW, I took a look at the latest react-router
, and I see what you are talking about–it looks like they are moving to a new naming convention as well (pushState
/replaceState
), so you are probably right to avoid calling it useReplaceWith
Just published as 0.3.0
!
I added optional support for
replaceWith
, because this functionality is especially useful for things like login transitions, where the back button taking you back to the login page is largely useless and annoying.I also updated the
README
to show the new way tocompose
store enhancers in Redux 2.0.@johanneslumpe