@react-hookz/web
Advanced tools
Comparing version 1.18.0 to 1.19.0
@@ -0,1 +1,8 @@ | ||
# [1.19.0](https://github.com/react-hookz/web/compare/v1.18.0...v1.19.0) (2021-05-16) | ||
### Features | ||
* new hooks `useLocalStorageValue` and `useSessionStorageValue` ([#43](https://github.com/react-hookz/web/issues/43)) ([f02e8ea](https://github.com/react-hookz/web/commit/f02e8ea61adffe8626d4e4b31073b24996802479)) | ||
# [1.18.0](https://github.com/react-hookz/web/compare/v1.17.0...v1.18.0) (2021-05-06) | ||
@@ -2,0 +9,0 @@ |
@@ -16,1 +16,3 @@ export { useFirstMountState } from './useFirstMountState'; | ||
export { useSyncedRef } from './useSyncedRef'; | ||
export { useLocalStorageValue } from './useLocalStorageValue'; | ||
export { useSessionStorageValue } from './useSessionStorageValue'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useSyncedRef = exports.useIsomorphicLayoutEffect = exports.useDebounceCallback = exports.useMediatedState = exports.useSafeState = exports.useConditionalUpdateEffect = exports.useConditionalEffect = exports.useIsMounted = exports.usePrevious = exports.useRerender = exports.useToggle = exports.useUnmountEffect = exports.useUpdateEffect = exports.useMountEffect = exports.useFirstMountState = void 0; | ||
exports.useSessionStorageValue = exports.useLocalStorageValue = exports.useSyncedRef = exports.useIsomorphicLayoutEffect = exports.useDebounceCallback = exports.useMediatedState = exports.useSafeState = exports.useConditionalUpdateEffect = exports.useConditionalEffect = exports.useIsMounted = exports.usePrevious = exports.useRerender = exports.useToggle = exports.useUnmountEffect = exports.useUpdateEffect = exports.useMountEffect = exports.useFirstMountState = void 0; | ||
var useFirstMountState_1 = require("./useFirstMountState"); | ||
@@ -34,1 +34,5 @@ Object.defineProperty(exports, "useFirstMountState", { enumerable: true, get: function () { return useFirstMountState_1.useFirstMountState; } }); | ||
Object.defineProperty(exports, "useSyncedRef", { enumerable: true, get: function () { return useSyncedRef_1.useSyncedRef; } }); | ||
var useLocalStorageValue_1 = require("./useLocalStorageValue"); | ||
Object.defineProperty(exports, "useLocalStorageValue", { enumerable: true, get: function () { return useLocalStorageValue_1.useLocalStorageValue; } }); | ||
var useSessionStorageValue_1 = require("./useSessionStorageValue"); | ||
Object.defineProperty(exports, "useSessionStorageValue", { enumerable: true, get: function () { return useSessionStorageValue_1.useSessionStorageValue; } }); |
export declare const noop: () => void; | ||
export declare const bypass: <T>(v: T) => T; | ||
export declare const isBrowser: boolean; | ||
export declare function truthyArrayItemsPredicate(conditions: ReadonlyArray<any>): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.truthyArrayItemsPredicate = exports.isBrowser = exports.bypass = exports.noop = void 0; | ||
exports.truthyArrayItemsPredicate = exports.isBrowser = exports.noop = void 0; | ||
var noop = function () { }; | ||
exports.noop = noop; | ||
var bypass = function (v) { return v; }; | ||
exports.bypass = bypass; | ||
exports.isBrowser = typeof window !== 'undefined' && | ||
@@ -9,0 +7,0 @@ typeof navigator !== 'undefined' && |
@@ -16,1 +16,3 @@ export { useFirstMountState } from './useFirstMountState'; | ||
export { useSyncedRef } from './useSyncedRef'; | ||
export { useLocalStorageValue } from './useLocalStorageValue'; | ||
export { useSessionStorageValue } from './useSessionStorageValue'; |
@@ -16,1 +16,3 @@ export { useFirstMountState } from "./useFirstMountState.js"; | ||
export { useSyncedRef } from "./useSyncedRef.js"; | ||
export { useLocalStorageValue } from "./useLocalStorageValue.js"; | ||
export { useSessionStorageValue } from "./useSessionStorageValue.js"; |
export declare const noop: () => void; | ||
export declare const bypass: <T>(v: T) => T; | ||
export declare const isBrowser: boolean; | ||
export declare function truthyArrayItemsPredicate(conditions: ReadonlyArray<any>): boolean; |
export var noop = function () { }; | ||
export var bypass = function (v) { return v; }; | ||
export var isBrowser = typeof window !== 'undefined' && | ||
@@ -4,0 +3,0 @@ typeof navigator !== 'undefined' && |
@@ -16,1 +16,3 @@ export { useFirstMountState } from './useFirstMountState'; | ||
export { useSyncedRef } from './useSyncedRef'; | ||
export { useLocalStorageValue } from './useLocalStorageValue'; | ||
export { useSessionStorageValue } from './useSessionStorageValue'; |
@@ -16,1 +16,3 @@ export { useFirstMountState } from "./useFirstMountState.js"; | ||
export { useSyncedRef } from "./useSyncedRef.js"; | ||
export { useLocalStorageValue } from "./useLocalStorageValue.js"; | ||
export { useSessionStorageValue } from "./useSessionStorageValue.js"; |
export declare const noop: () => void; | ||
export declare const bypass: <T>(v: T) => T; | ||
export declare const isBrowser: boolean; | ||
export declare function truthyArrayItemsPredicate(conditions: ReadonlyArray<any>): boolean; |
export const noop = () => { }; | ||
export const bypass = (v) => v; | ||
export const isBrowser = typeof window !== 'undefined' && | ||
@@ -4,0 +3,0 @@ typeof navigator !== 'undefined' && |
{ | ||
"name": "@react-hookz/web", | ||
"version": "1.18.0", | ||
"version": "1.19.0", | ||
"description": "React hooks done right, for browser and SSR.", | ||
@@ -112,3 +112,3 @@ "keywords": [ | ||
"jest-github-actions-reporter": "^1.0.3", | ||
"lint-staged": "^10.5.4", | ||
"lint-staged": "^11.0.0", | ||
"prettier": "^2.2.1", | ||
@@ -115,0 +115,0 @@ "react": "^17.0.2", |
@@ -0,5 +1,5 @@ | ||
<div align="center"> | ||
# ![@react-hookz/web](.github/logo.png) | ||
React hooks done right, for browser and SSR. | ||
[![NPM Version](https://flat.badgen.net/npm/v/@react-hookz/web)](https://www.npmjs.com/package/@react-hookz/web) | ||
@@ -12,2 +12,10 @@ [![NPM Downloads](https://flat.badgen.net/npm/dm/@react-hookz/web)](https://www.npmjs.com/package/@react-hookz/web) | ||
× **[DOCS](https://react-hookz.github.io/web/)** | ||
× **[DISCORD](https://discord.gg/Fjwphtu65f)** | ||
× **[CHANGELOG](https://github.com/react-hookz/web/blob/master/CHANGELOG.md)** × | ||
</div> | ||
--- | ||
`@react-hookz/web` is a library of general-purpose React hooks built with care and SSR compatibility | ||
@@ -26,3 +34,3 @@ in mind. | ||
As hooks was introduced to the world in React 16.8, `@react-hookz/web` requires - you guessed it - | ||
As hooks was introduced to the world in React 16.8, `@react-hookz/web` requires - you guessed it - | ||
`react` and `react-dom` 16.8+. | ||
@@ -55,4 +63,4 @@ Also, as React does not support IE, `@react-hookz/web` does not do so either. You'll have to | ||
- #### Callback | ||
- [`useDebounceCallback`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usedebouncecallback--example) | ||
- [**`useDebounceCallback`**](https://react-hookz.github.io/web/?path=/docs/callback-usedebouncecallback) | ||
— Makes passed function debounced, otherwise acts like `useCallback`. | ||
@@ -62,40 +70,47 @@ | ||
- [`useConditionalEffect`](https://react-hookz.github.io/web/?path=/docs/lifecycle-useconditionaleffect--example) | ||
— Like `useEffect` but callback invoked only if conditions match predicate. | ||
- [`useConditionalUpdateEffect`](https://react-hookz.github.io/web/?path=/docs/lifecycle-useconditionalupdateeffect--example) | ||
— Like `useUpdateEffect` but callback invoked only if conditions match predicate. | ||
- [`useFirstMountState`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usefirstmountstate--example) | ||
— Return boolean that is `true` only on first render. | ||
- [`useIsMounted`](https://react-hookz.github.io/web/?path=/docs/lifecycle-useismounted--example) | ||
— Returns function that yields current mount state. | ||
- [`useMountEffect`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usemounteffect--example) | ||
— Run effect only when component is first mounted. | ||
- [`useRerender`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usererender--example) | ||
— Return callback that re-renders component. | ||
- [`useUnmountEffect`](https://react-hookz.github.io/web/?path=/docs/lifecycle-useunmounteffect--example) | ||
— Run effect only when component is unmounted. | ||
- [`useUpdateEffect`](https://react-hookz.github.io/web/?path=/docs/lifecycle-useupdateeffect--example) | ||
— Effect hook that ignores the first render (not invoked on mount). | ||
- [`useIsomorphicLayoutEffect`](http://react-hookz.github.io/?path=/docs/lifecycle-useisomorphiclayouteffect--page) | ||
— `useLayoutEffect` for browser with fallback to `useEffect` for SSR. | ||
- [**`useConditionalEffect`**](https://react-hookz.github.io/web/?path=/docs/lifecycle-useconditionaleffect) | ||
— Like `useEffect` but callback invoked only if conditions match predicate. | ||
- [**`useConditionalUpdateEffect`**](https://react-hookz.github.io/web/?path=/docs/lifecycle-useconditionalupdateeffect) | ||
— Like `useUpdateEffect` but callback invoked only if conditions match predicate. | ||
- [**`useFirstMountState`**](https://react-hookz.github.io/web/?path=/docs/lifecycle-usefirstmountstate) | ||
— Return boolean that is `true` only on first render. | ||
- [**`useIsMounted`**](https://react-hookz.github.io/web/?path=/docs/lifecycle-useismounted) | ||
— Returns function that yields current mount state. | ||
- [**`useMountEffect`**](https://react-hookz.github.io/web/?path=/docs/lifecycle-usemounteffect) | ||
— Run effect only when component is first mounted. | ||
- [**`useRerender`**](https://react-hookz.github.io/web/?path=/docs/lifecycle-usererender) | ||
— Return callback that re-renders component. | ||
- [**`useUnmountEffect`**](https://react-hookz.github.io/web/?path=/docs/lifecycle-useunmounteffect) | ||
— Run effect only when component is unmounted. | ||
- [**`useUpdateEffect`**](https://react-hookz.github.io/web/?path=/docs/lifecycle-useupdateeffect) | ||
— Effect hook that ignores the first render (not invoked on mount). | ||
- [**`useIsomorphicLayoutEffect`**](https://react-hookz.github.io/?path=/docs/lifecycle-useisomorphiclayouteffect) | ||
— `useLayoutEffect` for browser with fallback to `useEffect` for SSR. | ||
- #### State | ||
- [`useMediatedState`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usemediatedstate--example) | ||
— Like `useState`, but every value set is passed through a mediator function. | ||
- [`usePrevious`](https://react-hookz.github.io/web/?path=/docs/lifecycle-useprevious--example) | ||
— Returns the value passed to the hook on previous render. | ||
- [`useSafeState`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usesafestate--page) | ||
— Like `useState`, but its state setter is guarded against sets on unmounted component. | ||
- [`useToggle`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usetoggle--example) | ||
— Like `useState`, but can only become `true` or `false`. | ||
- [**`useMediatedState`**](https://react-hookz.github.io/web/?path=/docs/state-usemediatedstate) | ||
— Like `useState`, but every value set is passed through a mediator function. | ||
- [**`usePrevious`**](https://react-hookz.github.io/web/?path=/docs/state-useprevious) | ||
— Returns the value passed to the hook on previous render. | ||
- [**`useSafeState`**](https://react-hookz.github.io/web/?path=/docs/state-usesafestate) | ||
— Like `useState`, but its state setter is guarded against sets on unmounted component. | ||
- [**`useToggle`**](https://react-hookz.github.io/web/?path=/docs/state-usetoggle) | ||
— Like `useState`, but can only become `true` or `false`. | ||
- #### Navigator | ||
- [`useNetworkState`](http://react-hookz.github.io/?path=/docs/sensor-usenetwork--example) | ||
— Tracks the state of browser's network connection. | ||
- [**`useNetworkState`**](https://react-hookz.github.io/?path=/docs/navigator-usenetwork) | ||
— Tracks the state of browser's network connection. | ||
- #### Miscellaneous | ||
- [`useSyncedRef`](http://react-hookz.github.io/?path=/docs/miscellaneous-usesyncedref--example) | ||
— Like `useRef`, but it returns immutable ref that contains actual value. | ||
- [**`useSyncedRef`**](https://react-hookz.github.io/?path=/docs/miscellaneous-usesyncedref) | ||
— Like `useRef`, but it returns immutable ref that contains actual value. | ||
- #### Side-effects | ||
- [**`useLocalStorageValue`**](https://react-hookz.github.io/?path=/docs/side-effects-uselocalstoragevalue) | ||
— Manages a single LocalStorage key. | ||
- [**`useSessionStorageValue`**](https://react-hookz.github.io/?path=/docs/side-effects-usesessionstoragevalue) | ||
— Manages a single SessionStorage key. |
138145
142
2703
113