react-lazy
react-lazy copied to clipboard
Feature request: Compatibility with libraries that rely on using react context api
If child of <Lazy> component rely on react context api then this component breaks, since, as far as I understand, context is not passed. For example if we use connect
from react redux to wrap child component then store
is not passed, another example if we use withRouter
from react router 4 then router
is not passed to child.
this is also my main blocker that prevent me from using this package
Hi! Sorry for responding so very late.
This is currently a limitation of React (issue 14292) as it is impossible to pass context when executing renderToStaticMarkup
on client side. And this is required to generate HTML for <noscript />
elements. I've now subscribed to the issue above and I'll add support once React provides a way to provide the context.
In the meanwhile you can use clientOnly
flag and will have no problem as there will be nothing rendered server side (and similarly nothing during initial render on client).