🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@react-hookz/web

Package Overview
Dependencies
Maintainers
2
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hookz/web - npm Package Compare versions

Comparing version

to
1.6.2

dist/useRerender.d.ts

14

CHANGELOG.md

@@ -0,1 +1,15 @@

## [1.6.2](https://github.com/react-hookz/web/compare/v1.6.1...v1.6.2) (2021-04-22)
### Bug Fixes
* add hook link to README.md ([368f1d9](https://github.com/react-hookz/web/commit/368f1d9b595eec113cadffa217ef01041a6a4c72))
# [1.7.0](https://github.com/react-hookz/web/compare/v1.6.1...v1.7.0) (2021-04-22)
### Features
* add storybook docs with deploy to gh-pages ([84de312](https://github.com/react-hookz/web/commit/84de312a607f202c8957ae3f6d32c453cffe134a))
## [1.6.1](https://github.com/react-hookz/web/compare/v1.6.0...v1.6.1) (2021-04-21)

@@ -2,0 +16,0 @@

1

dist/index.d.ts

@@ -6,1 +6,2 @@ export { useFirstMountState } from './useFirstMountState';

export { useToggle } from './useToggle';
export { useRerender } from './useRerender';

4

dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useToggle = exports.useUnmountEffect = exports.useUpdateEffect = exports.useMountEffect = exports.useFirstMountState = void 0;
exports.useRerender = exports.useToggle = exports.useUnmountEffect = exports.useUpdateEffect = exports.useMountEffect = exports.useFirstMountState = void 0;
var useFirstMountState_1 = require("./useFirstMountState");

@@ -14,2 +14,4 @@ Object.defineProperty(exports, "useFirstMountState", { enumerable: true, get: function () { return useFirstMountState_1.useFirstMountState; } });

Object.defineProperty(exports, "useToggle", { enumerable: true, get: function () { return useToggle_1.useToggle; } });
var useRerender_1 = require("./useRerender");
Object.defineProperty(exports, "useRerender", { enumerable: true, get: function () { return useRerender_1.useRerender; } });
//# sourceMappingURL=index.js.map
/**
* Returns boolean that is `true` only on first render
* Return boolean that is `true` only on first render
*/
export declare function useFirstMountState(): boolean;

@@ -6,3 +6,3 @@ "use strict";

/**
* Returns boolean that is `true` only on first render
* Return boolean that is `true` only on first render
*/

@@ -9,0 +9,0 @@ function useFirstMountState() {

/**
* Run effect only when component is first mounted.
*
* @param effect effector to run on mount
* @param effect Effector to run on mount
*/
export declare function useMountEffect(effect: CallableFunction): void;

@@ -8,3 +8,3 @@ "use strict";

*
* @param effect effector to run on mount
* @param effect Effector to run on mount
*/

@@ -11,0 +11,0 @@ function useMountEffect(effect) {

import { IInitialState, INewState } from './util/resolveHookState';
/**
* Like `useState`, but can only become `true` or `false`.
*
* State setter, in case called without arguments, will change the state to opposite.
*
* @param initialState Initial toggle state, defaults to false.
*/
export declare function useToggle(initialState?: IInitialState<boolean>): [boolean, (nextState?: INewState<boolean>) => void];

@@ -6,2 +6,9 @@ "use strict";

var resolveHookState_1 = require("./util/resolveHookState");
/**
* Like `useState`, but can only become `true` or `false`.
*
* State setter, in case called without arguments, will change the state to opposite.
*
* @param initialState Initial toggle state, defaults to false.
*/
function useToggle(initialState) {

@@ -8,0 +15,0 @@ if (initialState === void 0) { initialState = false; }

/**
* Run effect only when component is unmounted.
*
* @param effect effector to run on unmount
* @param effect Effector to run on unmount
*/
export declare function useUnmountEffect(effect: CallableFunction): void;

@@ -8,3 +8,3 @@ "use strict";

*
* @param effect effector to run on unmount
* @param effect Effector to run on unmount
*/

@@ -11,0 +11,0 @@ function useUnmountEffect(effect) {

import { DependencyList, EffectCallback } from 'react';
/**
* React effect hook that ignores the first invocation (e.g. on mount)
* Effect hook that ignores the first render (not invoked on mount)
*
* @param effect effector to run on updates
* @param deps dependencies list, as for `useEffect` hook
* @param effect Effector to run on updates
* @param deps Dependencies list, as for `useEffect` hook
*/
export declare function useUpdateEffect(effect: EffectCallback, deps?: DependencyList): void;

@@ -7,6 +7,6 @@ "use strict";

/**
* React effect hook that ignores the first invocation (e.g. on mount)
* Effect hook that ignores the first render (not invoked on mount)
*
* @param effect effector to run on updates
* @param deps dependencies list, as for `useEffect` hook
* @param effect Effector to run on updates
* @param deps Dependencies list, as for `useEffect` hook
*/

@@ -13,0 +13,0 @@ function useUpdateEffect(effect, deps) {

{
"name": "@react-hookz/web",
"version": "1.6.1",
"version": "1.6.2",
"license": "MIT",

@@ -26,8 +26,11 @@ "repository": {

"test:coverage": "yarn test --coverage",
"lint": "eslint . --ext ts,js,tsx,jsx",
"lint": "eslint ./ ./.storybook --ext ts,js,tsx,jsx",
"lint:fix": "yarn lint --fix",
"prepare": "husky install"
"prepare": "husky install",
"storybook:watch": "start-storybook -p 6006",
"storybook:build": "build-storybook -o ./storybook-build",
"storybook:deploy": "storybook-to-ghpages -s storybook:build"
},
"lint-staged": {
"*.[tj]s?x": "eslint --fix"
"*.{js,jsx,ts,tsx}": "eslint --fix"
},

@@ -58,2 +61,3 @@ "commitlint": {

"devDependencies": {
"@babel/core": "^7.13.16",
"@commitlint/config-conventional": "^12.1.1",

@@ -63,2 +67,8 @@ "@semantic-release/changelog": "^5.0.1",

"@semantic-release/github": "^7.2.1",
"@storybook/addon-essentials": "^6.2.8",
"@storybook/addon-links": "^6.2.8",
"@storybook/addons": "^6.2.8",
"@storybook/react": "^6.2.8",
"@storybook/storybook-deployer": "^2.8.7",
"@storybook/theming": "^6.2.8",
"@testing-library/react-hooks": "^5.1.1",

@@ -68,2 +78,3 @@ "@types/jest": "^26.0.22",

"@typescript-eslint/parser": "^4.22.0",
"babel-loader": "^8.2.2",
"commitlint": "^12.1.1",

@@ -70,0 +81,0 @@ "eslint": "^7.24.0",

<div align="center">
<h1><img src="./logo.png" alt="@react-hookz/web"></h1>
<h1><img src=".github/logo.png" alt="@react-hookz/web"></h1>
<p>

@@ -28,2 +28,3 @@ <a href="https://www.npmjs.com/package/@react-hookz/web">

WIP
- #### Lifecycle hooks
- `useUpdateEffect` - Effect hook that ignores the first render (not invoked on mount).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet