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

Use cloneElement or children when hydrating

Open ScriptedAlchemy opened this issue 5 years ago • 1 comments

It would be nice to have the following functionality, providing no additional DOM elements when hydrating. Not sure if its possible but thought id ask.

 if (isVisible || mode === 'static') {
    return <Fragment>{children}</Fragment>
  }

ScriptedAlchemy avatar Apr 06 '20 21:04 ScriptedAlchemy

I think is not possible because you don't create additional DOM element and react break html. But i will try this example.

Now, you could use

const Header = () => (
  <LazyRender wrapper={React.Fragment}>
    <HeavyHeader />
  </LazyRender>
);

Tom910 avatar Apr 07 '20 06:04 Tom910