Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ezekielchentnik/preact-no-ssr

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.
https://github.com/ezekielchentnik/preact-no-ssr

above-the-fold isomorphic preact progressive-web-app rollem rollup ssr universal-javascript

Last synced: 2 months ago
JSON representation

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.

Awesome Lists containing this project

README

        

# `` _for [Preact]_

[![NPM](https://img.shields.io/npm/v/preact-no-ssr.svg)](https://www.npmjs.com/package/preact-no-ssr)
[![Travis](https://travis-ci.org/gufsky/preact-no-ssr.svg?branch=master)](https://travis-ci.org/gufsky/preact-no-ssr)

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.

#### [Demo](https://github.com/ezekielchentnik/preact-pwa)

---

## Usage Example

Install
```bash
npm i preact-no-ssr --save
```

Wrap the components you do not want to render on server when using 'preact-render-to-string'

```js
import NoSsr from 'preact-no-ssr';

} // placeholder to render on server, defaults to null
skip={false} // toggle on/off server render, defaults to true
>

Stuff to not render on server

```

## Props

| Prop | Type | Description |
|---------------------|------------|---------------------|
| **`placeholder`** | _Function_ | Component to render on server
| **`skip`** | _Boolean_ | If `false`, renders on server

### License

[MIT]

[Preact]: https://github.com/developit/preact
[MIT]: http://choosealicense.com/licenses/mit/