0.1.0 • Published 3 years ago

react-lazy-hydration v0.1.0

Weekly downloads
9,020
License
MIT
Repository
github
Last release
3 years ago

React Lazy Hydration

Lazy Hydration for Server Rendered React Components

Installation

npm i react-lazy-hydration

OR

yarn add react-lazy-hydration

Usage

import React from "react";
import LazyHydrate from "react-lazy-hydration";

function App() {
  return (
    <div>
      {/* Skip Hydrating  */}
      <LazyHydrate ssrOnly>
        {...}
      </LazyHydrate>
      {/* Requires IntersectionObserver. Polyfill not included. */}
      <LazyHydrate whenVisible>
        {...}
      </LazyHydrate>
      {/* Requires requestIdleCallback. Polyfill not included. */}
      <LazyHydrate whenIdle>
        {...}
      </LazyHydrate>
      {/* Hydrate on any of the following events */}
      <LazyHydrate on="click" /*OR on={["click","mouseenter",...]} */>
        {...}
      </LazyHydrate>
    </div>
  );
}

Notes

Based on this comment

and heavily adapted from Lazy hydration for Vue SSR

Contribute

First off, thanks for taking the time to contribute! Now, take a moment to be sure your contributions make sense to everyone else.

Reporting Issues

Found a problem? Want a new feature? First of all see if your issue or idea has already been reported. If not, just open a new clear and descriptive issue.

Submitting pull requests

Pull requests are the greatest contributions, so be sure they are focused in scope, and do avoid unrelated commits.

0.1.0

3 years ago

0.0.12

3 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago