My project, which is using okta-react and react-router, recently had a react-router bump to @5.0.1. After doing so I’m seeing:
Error: Invariant failed: You should not use <withRouter(Security) /> outside a
I understand the normal circumstances with which this error is thrown, but in the case of my project
<Security...> is located within a
Router instance. Hacking around in the okta-react dist directory and removing the
withRouter wrapping from the
Security.js export resolves the issue.
I don’t believe this is an issue with react-router (not impossible, though) because they have 100% backwards compatibility with react-router@4. I’m wondering if anyone else can recreate this issue.