# @midudev/react-progressive-hydration

> Server Side Rendering for a component and skip the hydration step on the client but, as soon as it appears on the viewport, then hydrate it. Useful for list of items.

Latest version **2.0.2** (published 2020-04-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install @midudev/react-progressive-hydration
pnpm add @midudev/react-progressive-hydration
yarn add @midudev/react-progressive-hydration
bun add @midudev/react-progressive-hydration
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2020-04-29 |
| First published | 2019-10-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Miguel Ángel Durán |
| Maintainers | miduga |
| Keywords | react, react rendering, dynamic rendering, static rendering, progressive hydration |

## Links

- npm: https://www.npmjs.com/package/@midudev/react-progressive-hydration
- npm.io page: https://npm.io/package/@midudev/react-progressive-hydration

## Dependencies (1)

- [intersection-observer](https://npm.io/package/intersection-observer.md) 0.10.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2020-04-29
- 2.0.1 — 2020-02-18
- 2.0.0 — 2020-02-05
- 1.0.5 — 2019-10-24
- 1.0.2 — 2019-10-24

## README

# Progressive Hydration 🏁

Server Side Rendering for a component and skip the hydration step on the client but, as soon as it appears on the viewport, hydrate it. Useful for list of items or components that are not visible on the viewport but yet you need to render them for SEO.

## Results of using it

### Benefits... 👍

- 👀 Only re-hydrate what's visible
- 🤳 Thus could greatly improve TTI
- 🔛 Activate interactivity on demand

### Downsides... 👎
- 🏋️‍ Hydration data still there
- 🥪 Element wrapper needed (ex. `<div>`)

### Keep in mind... 🧠
- 📸 Kind of lazy loading experience
- 🤖 GoogleBot will get the rendered static html (not hydrated)

## How to use 👨‍🏫
Just wrap the components you want to be hydrated progressively.

Use `force` prop in order to hydrate the component no matter if it's below the fold.

```javascript
import ProgressiveHydration from '@midudev/react-progressive-hydration'

export default function ProgressiveHydrationPage({articles}) {
  return (
    <Grid>
      {articles.map((article, idx) => (
        <ProgressiveHydration key={idx} force={idx < 3}>
          <Card {...article} />
        </ProgressiveHydration>
      ))}
    </Grid>
  )
}
```


## Resources 🔗
[The case of partial hydration (with Next and Preact)](https://medium.com/spring-media-techblog/how-we-achieved-the-best-web-performance-with-partial-hydration-20fab9c808d5)
[Rendering on the Web: Performance Implications of Application Architecture](https://www.youtube.com/watch?v=k-A2VfuUROg)
[Hack for avoiding hydration](https://github.com/facebook/react/issues/10923#issuecomment-338715787)

---
_Source: https://npm.io/package/@midudev/react-progressive-hydration · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
