use-isomorphic-layout-effect
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "use-isomorphic-layout-effect", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A React helper hook for scheduling a layout effect with a fallback to a regular effect for environments where layout effects should not be used (such as server-side rendering).", | ||
@@ -31,3 +31,3 @@ "main": "dist/use-isomorphic-layout-effect.cjs.js", | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0" | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "peerDependenciesMeta": { |
# use-isomorphic-layout-effect | ||
A React helper hook for scheduling a layout effect with a fallback to a regular effect for environments where layout effects should not be used (such as server-side rendering). | ||
## Installation | ||
```sh | ||
$ npm i use-isomorphic-layout-effect | ||
``` | ||
## Usage | ||
You only need to switch `useLayoutEffect` with `useIsomorphicLayoutEffect` | ||
```diff | ||
+ import useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect'; | ||
- import { useLayoutEffect } from 'react'; | ||
const YourComponent = () => { | ||
+ useIsomorphicLayoutEffect(() => { | ||
- useLayoutEffect(() => { | ||
// your implementation | ||
}, []); | ||
}; | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4811
27