Ask people to use 5.1 instead? #24
Description
Hi @CharlesStover 👋
I think this package has been causing some problems with people who are using React Router and getting 2 different copies of our context object. The problem is that you depend on react-router
, so you have one instance of our __RouterContext
object. But react-router-dom
and react-router-native
also depend on react-router
, so if the 2 copies don't match up exactly then people end up using a different instance of context which breaks things.
It's hard to reproduce this behavior because package managers vary in how they decide to hoist dependencies and deduplicate them. But we've seen a few issues crop up in the main router repo that seem to indicate we have an ecosystem problem (see remix-run/react-router#6755).
The solution is that you should never depend on react-router
directly. Instead, you should depend on react-router-dom
or react-router-native
, depending on which platform you're targeting.
But there's also some good news, and that is that we shipped some hooks yesterday in v5.1, so people shouldn't need use-react-router
anymore. So an even simpler solution would be to deprecate this package with a notice message that encourages people to use v5.1 instead. This would also be ideal for us since we never intended 3rd party libs to use our context object (hence the __
prefix).
Thanks!