import { render } from 'react-dom';
const container = document.getElementById('app');
render(<App/>, container);
import { createRoot } from 'react-dom/client';
const container = document.getElementById('app');
const root = createRoot(container);
root.render(<App/>);
Before
After
import { hydrate } from 'react-dom';
const container = document.getElementById('app');
hydrate(<App/>, container);
import { hydrateRoot } from 'react-dom/client';
const container = document.getElementById('app');
const root = hydrateRoot(container, <App/>);
// Unlike with createRoot,
// you don't need a separate root.render() call here.
Before
After
unmountComponentAtNode(container);
root.unmount();
Before
After
<Layout>
<NavBar />
<Sidebar />
<RightPane>
<Post />
<Comments />
</RightPane>
</Layout>
<Layout>
<NavBar />
<Sidebar />
<RightPane>
<Post />
<Comments />
</RightPane>
</Layout>
<Layout>
<NavBar />
<Sidebar />
<RightPane>
<Post />
<Comments />
</RightPane>
</Layout>
<main>
<nav>
</nav>
<aside>
</aside>
<article>
</article>
<section>
</section>
</main>
Using the <Offscreen> component - example