Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transitioning components with React-router Links #66

Open
v-ko opened this issue Dec 5, 2019 · 1 comment
Open

Transitioning components with React-router Links #66

v-ko opened this issue Dec 5, 2019 · 1 comment

Comments

@v-ko
Copy link

v-ko commented Dec 5, 2019

Hi, overdrive has a great concept, thanks for the work you've done!

I'm having a problem with the use cases stated in the title: I'm trying to animate a menu transition and the React-router Links in that menu break the animation with an error stating they need to be in an ancestor of a Router element.
I figured the problem comes from the fact that the animation is rendered in a div, that is created as a child of the body element (which is above the Router). It may as well be the case that the renderSubtreeIntoContainer method doesn't give access to the parent elements, because I tried replacing window.document.body.appendChild with window.document.getElementById('App') (the main class in my tests, that is nested in a BrowserRouter).
Is this for simplicity's sake or would it complicate things if the start and end animation elements were rendered each as a child of the Overdrive component (in the render function)? They have absolute positions after all.
I believe that way the renderSubtreeIntoContainer call wouldn't be needed.
I tried implementing the above but quickly found myself over my head with the debugging, I'm quite new to React.

@barbararcbf12
Copy link

Hi, overdrive has a great concept, thanks for the work you've done!

I'm having a problem with the use cases stated in the title: I'm trying to animate a menu transition and the React-router Links in that menu break the animation with an error stating they need to be in an ancestor of a Router element.
I figured the problem comes from the fact that the animation is rendered in a div, that is created as a child of the body element (which is above the Router). It may as well be the case that the renderSubtreeIntoContainer method doesn't give access to the parent elements, because I tried replacing window.document.body.appendChild with window.document.getElementById('App') (the main class in my tests, that is nested in a BrowserRouter).
Is this for simplicity's sake or would it complicate things if the start and end animation elements were rendered each as a child of the Overdrive component (in the render function)? They have absolute positions after all.
I believe that way the renderSubtreeIntoContainer call wouldn't be needed.
I tried implementing the above but quickly found myself over my head with the debugging, I'm quite new to React.

I am facing tha same issue. When navigating through the routes via Link, I get the following error

Error: Invariant failed: You should not use <Link> outside a <Router>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants