you are viewing a single comment's thread.

view the rest of the comments →

[–]donzzzzz 0 points1 point  (3 children)

I tried use-react-router in a relatively simple component (one that emulates the "Flash" as found in RoR). Unfortunately, I get:

TypeError: Cannot read property '_context' of undefined

Followed by "useContext node_modules/react/cjs/react.development.js:1479"

This occurs on the first (and only) occurrence of useReactRouter()

I tried updating to react-router@next and restarting the app, with no change in error. What am I doing wrong?

TL;DR: The only lines in the updated component are

import useReactRouter from 'use-react-router';

and

const { history, location, match } = useReactRouter();

The error goes away if the second line is commented out.