clientOnly
Edit this pageWrapping components in clientOnly
will cause them render only in the client.
This can useful for components that interact directly with the DOM, such as jQuery, since they can not render on the server.
It works similar to lazy
but will only render after hydration and will never load on the server.
To use clientOnly
, isolate the desired component with DOM interactions in a file:
Once isolated, it can then be imported dynamically using clientOnly
:
Parameters
Argument | Type | Description |
---|---|---|
fn | () => Promise | Function to be run client-side only. |