react-lazy icon indicating copy to clipboard operation
react-lazy copied to clipboard

Feature request: Compatibility with libraries that rely on using react context api

Open dmitriy-baltak opened this issue 5 years ago • 2 comments

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.

dmitriy-baltak avatar Jul 13 '18 11:07 dmitriy-baltak

this is also my main blocker that prevent me from using this package

laurentlaporte avatar Feb 07 '19 16:02 laurentlaporte

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).

Merri avatar Apr 26 '19 11:04 Merri