Okta React SDK - SecureRoute.js:32 Uncaught TypeError: (0 , _reactRouterDom.useHistory) is not a function at RequireAuth (SecureRoute.js:32)

I’ve recently upgraded the okta react SDK to v2.0.0, and have followed the migration instructions from 1X. All is ‘almost’ working well, however I’m receiving the below error. Per the dependencies listed in the documentation, I’m using appropriate version of both react and react-router-dom.

SecureRoute.js:32 Uncaught TypeError: (0 , _reactRouterDom.useHistory) is not a function
at RequireAuth (SecureRoute.js:32)

image

I wanted to check here for a solution prior to submitting a bug report.

Thanks!

Just an update, I’ve addressed this issue by updating react-router-dom to v5.1.2…The okta react SDK docs should be updated to state v>= 5.1 per the below npm warning, rather than v5+.

Can you please enter an issue for this in the Okta React SDK’s repo? That way we can get it fixed. https://github.com/okta/okta-oidc-js

@mraible

Will do, and thank you for all you all do

1 Like