1.2.1 • Published 3 years ago

use-subsequent-effect v1.2.1

Weekly downloads
69
License
MIT
Repository
github
Last release
3 years ago

use-subsequent-effect

⏭ A use(Layout)Effect variant hook that skips the initial render.

build npm gzipped license

Installation

Skypack

import { useSubsequentEffect } from "https://cdn.skypack.dev/use-subsequent-effect"

Yarn

yarn add use-subsequent-effect

npm

npm install use-subsequent-effect

Usage

Import useSubsequentEffect, useSubsequentLayoutEffect or useSubsequentIsomorphicLayoutEffect.

import { useSubsequentEffect } from "use-subsequent-effect"

Use it as a drop-in use(Layout)Effect replacement.

useSubsequentEffect(() => {
  dependency.update()

  return () => {
    dependency.clean()
  }
}, [dependency])

ESLint

If you are using eslint-plugin-react-hooks, there's no need to specify a custom additionalHooks list. The react-hooks/exhaustive-deps rule already works out-of-the-box on all effect hooks (/Effect($|[^a-z])/g).

1.2.1

3 years ago

1.2.0

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago