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

Portals break context #2

Open
acdlite opened this issue Feb 5, 2015 · 2 comments
Open

Portals break context #2

acdlite opened this issue Feb 5, 2015 · 2 comments

Comments

@acdlite
Copy link

acdlite commented Feb 5, 2015

When I try to use React Router's <Link /> component inside a <MagicMove /> container, it breaks.

Warning: Required context `isActive` was not specified in `Link`.

I believe this is because the cloned links are in a totally separate different render tree, so they cannot access context provided by the router. One of the downsides of portals, I suppose.

I can't think of a good solution. The only one that comes to mind is to provide an interface to dynamically create the MagicMove class, so that you can insert a static contextTypes property as needed. But that's gross, right?

@acdlite
Copy link
Author

acdlite commented Feb 5, 2015

Maybe a make MagicMove a wrapper component that internally creates a component on the fly. It either returns the default MagicMove component, or if a context prop is provided, it creates a new component with React.createClass() with the given context and returns that.

@acdlite acdlite changed the title Portals breaks context Portals break context Feb 6, 2015
@cocodrino
Copy link

@acdlite yes..seems than child nodes (nested elements) doesnt receive the context, I'm facing the same problem right now because I'm using baobab and the tree is passed using the context

maybe this discussion could give you an idea
github.com/Yomguithereal/baobab-react/issues/52

I was checking the code of react-magic-move but some parts are a bit difficult to understand for me, basically because it works using react in a very special way

this problem seems will be solved with react 14 but if you can solve this lib before that please let me know.thanks!.

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