reactjs / react-transition-group

An easy way to perform animations when a React component enters or leaves the DOM
https://reactcommunity.org/react-transition-group/
Other
10.18k stars 649 forks source link

Check the render method of `Router.Consumer` #683

Open h1sashin opened 3 years ago

h1sashin commented 3 years ago

I get this error every time I try to use react-transition-group with react-router

`× Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of Router.Consumer.`

I get this even when I just copy code from https://reactcommunity.org/react-transition-group/with-react-router so I think it's problem with react-transition-group. Tried using v1, tried using react-tiger-transition, always the same error.

rwmsousa commented 2 years ago

Check the form you are importing. It is necessary to put the BrowserRouter in the import. Look:

import { BrowserRouter as Router, switch, route } from "react-router-dom";