Is it possible to enforce an SSR-only mode in Next.js and only partially hydrate the page? Let's say I have this app:
components/dynamic.jsx
export default () => (
<button onClick={() => console.log("I have been clicked")}>Click me</button>
)
pages/index.jsx
import DynamicComponent from "../components/dynamic.jsx";
export default () => (
<div>
<h1>Hello World</h1>
<p>Lorem ipsum</p>
<Hydrate>
<DynamicComponent />
</Hydrate>
</div>
);
Now assume we are rendering pages/index.jsx
with Next.js
so it will be rendered on the server and fully hydrated on the client. For performance reasons (shrink bundle size, reduce execution time) and to have the app play nicer with ads (????) I only want to hydrate the DynamicComponent
on the client and at best only load the JavaScript for the DynamicComponent
to the client.
Ist that possible with
- React?
- Next.js?
Thanks