react-lazy-hydration
react-lazy-hydration copied to clipboard
`noWrapper` prop isn't used
Not sure if this lib is still being maintained as there hasn't been much activity in a while but i've come across an issue when using the noWrapper prop.
When doing something like:
<LazyHydrate whenIdle noWrapper="nav">
/* ...complex component ... */
</LazyHydrate>
the tag specified in noWrapper is ignored and just the children are returned.
I've put together an example repo here: https://codesandbox.io/s/strange-napier-6tvbp4?file=/src/App.tsx
From a quick look over the code, my guess is it has something to do with the if statement on line 168:
https://github.com/hadeeb/react-lazy-hydration/blob/8faafaa86ecb0f97ac0296882b438eabe158de5e/src/index.tsx#L168-L170
It looks like that's checking whether noWrapper exists rather than whether its actual value is true...
if (noWrapper) { // here noWrapper could be string or true
return children;
}
but the problem may be deeper than that.