Okta-react: `invariant violation` when upgrading to react-router@5

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.

Can you please put together a quick prototype that demonstrates this issue and post it to GitHub?

Yep. Will do. I’ll post it with the same title. Thanks @mraible.

Apologies, my monorepo (lerna) had a conflict of versions. Thanks again for the prompt reply.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.