<NoSir />
for Preact
A Preact component for skipping server side rendering (SSR) of components. This component helps render components on the server that make sense to be rendered above the fold or that only makes sense to render on client. Depending on your server side render, this can significantly boost performance.
Install
npm i preact-no-ssr --save
Wrap the components you do not want to render on server when using 'preact-render-to-string'
import NoSsr from 'preact-no-ssr';
<NoSsr
placeholder={<MySpinnerOrPlaceholder />} // placeholder to render on server, defaults to null
skip={false} // toggle on/off server render, defaults to true
>
<div>Stuff to not render on server</div>
</NoSsr>
Prop | Type | Description |
---|---|---|
placeholder |
Function | Component to render on server |
skip |
Boolean | If false , renders on server |