Package Exports
- @react-hookz/web
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@react-hookz/web) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React hooks done right, for browser and SSR.
@react-hookz/web is a library of general-purpose React hooks built with care and SSR compatibility
in mind.
Install
This one is pretty simple, everyone knows what to do:
npm i @react-hookz/web
# or
yarn add @react-hookz/webAs hooks been introduced to the world in React 16.8 @react-hookz/web has requires, you gessed
it, react and react-dom 16.8+.
Also, as React does not support IE, @react-hookz/web does not do that either. You'll have to
transpile your node-modules in order to run in IE.
Usage
This package provides three levels of compilation:
- Main, the
/cjsfolder — CommonJS modules, with ES5 lang level. - ESM, the
/esmfolder — it is ES modules, with ES5 lang level. - ESNext, the
/esnextfolder — it is ES modules, with ESNext lang level.
So, if you need useMountEffect hook, depending on your needs, you can import in three ways (
actually there is more, but in common it is three):
// in case you need cjs modules
import { useMountEffect } from "@react-hookz/web";
// in case you need esm modules
import { useMountEffect } from "@react-hookz/web/esm";
// in case you want all the recent ES features
import { useMountEffect } from "@react-hookz/web/esnext";Hooks list
Lifecycle hooks
useFirstMountState— Return boolean that istrueonly on first render.useUpdateEffect— Effect hook that ignores the first render (not invoked on mount).
