Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-hookz/web

Package Overview
Dependencies
Maintainers
2
Versions
128
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 1.12.0 to 1.13.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.13.0](https://github.com/react-hookz/web/compare/v1.12.0...v1.13.0) (2021-05-02)
### Features
* make stateful hooks use `useSafeState` ([d181c7f](https://github.com/react-hookz/web/commit/d181c7f56c5abab1c6e2b7064425a10bec668062))
# [1.12.0](https://github.com/react-hookz/web/compare/v1.11.0...v1.12.0) (2021-05-01)

@@ -2,0 +9,0 @@

4

cjs/useRerender.js

@@ -5,2 +5,3 @@ "use strict";

var react_1 = require("react");
var useSafeState_1 = require("./useSafeState");
var stateChanger = function (state) { return !state; };

@@ -11,7 +12,8 @@ /**

function useRerender() {
var _a = react_1.useState(false), setState = _a[1];
var _a = useSafeState_1.useSafeState(false), setState = _a[1];
return react_1.useCallback(function () {
setState(stateChanger);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}
exports.useRerender = useRerender;
import { IInitialState, INewState } from './util/resolveHookState';
/**
* Like `useState`, but can only become `true` or `false`.
* Like `useSafeState`, but can only become `true` or `false`.
*

@@ -5,0 +5,0 @@ * State setter, in case called without arguments, will change the state to opposite.

@@ -6,4 +6,5 @@ "use strict";

var resolveHookState_1 = require("./util/resolveHookState");
var useSafeState_1 = require("./useSafeState");
/**
* Like `useState`, but can only become `true` or `false`.
* Like `useSafeState`, but can only become `true` or `false`.
*

@@ -20,3 +21,3 @@ * State setter, in case called without arguments, will change the state to opposite.

// toggle logic.
var _a = react_1.useState(initialState), state = _a[0], _setState = _a[1];
var _a = useSafeState_1.useSafeState(initialState), state = _a[0], _setState = _a[1];
return [

@@ -31,2 +32,3 @@ state,

});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []),

@@ -33,0 +35,0 @@ ];

@@ -1,2 +0,3 @@

import { useCallback, useState } from 'react';
import { useCallback } from 'react';
import { useSafeState } from './useSafeState';
var stateChanger = function (state) { return !state; };

@@ -7,6 +8,7 @@ /**

export function useRerender() {
var _a = useState(false), setState = _a[1];
var _a = useSafeState(false), setState = _a[1];
return useCallback(function () {
setState(stateChanger);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}
import { IInitialState, INewState } from './util/resolveHookState';
/**
* Like `useState`, but can only become `true` or `false`.
* Like `useSafeState`, but can only become `true` or `false`.
*

@@ -5,0 +5,0 @@ * State setter, in case called without arguments, will change the state to opposite.

@@ -1,5 +0,6 @@

import { useCallback, useState } from 'react';
import { useCallback } from 'react';
import { resolveHookState } from './util/resolveHookState';
import { useSafeState } from './useSafeState';
/**
* Like `useState`, but can only become `true` or `false`.
* Like `useSafeState`, but can only become `true` or `false`.
*

@@ -16,3 +17,3 @@ * State setter, in case called without arguments, will change the state to opposite.

// toggle logic.
var _a = useState(initialState), state = _a[0], _setState = _a[1];
var _a = useSafeState(initialState), state = _a[0], _setState = _a[1];
return [

@@ -27,4 +28,5 @@ state,

});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []),
];
}

@@ -1,2 +0,3 @@

import { useCallback, useState } from 'react';
import { useCallback } from 'react';
import { useSafeState } from './useSafeState';
const stateChanger = (state) => !state;

@@ -7,6 +8,7 @@ /**

export function useRerender() {
const [, setState] = useState(false);
const [, setState] = useSafeState(false);
return useCallback(() => {
setState(stateChanger);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}
import { IInitialState, INewState } from './util/resolveHookState';
/**
* Like `useState`, but can only become `true` or `false`.
* Like `useSafeState`, but can only become `true` or `false`.
*

@@ -5,0 +5,0 @@ * State setter, in case called without arguments, will change the state to opposite.

@@ -1,5 +0,6 @@

import { useCallback, useState } from 'react';
import { useCallback } from 'react';
import { resolveHookState } from './util/resolveHookState';
import { useSafeState } from './useSafeState';
/**
* Like `useState`, but can only become `true` or `false`.
* Like `useSafeState`, but can only become `true` or `false`.
*

@@ -15,3 +16,3 @@ * State setter, in case called without arguments, will change the state to opposite.

// toggle logic.
const [state, _setState] = useState(initialState);
const [state, _setState] = useSafeState(initialState);
return [

@@ -26,4 +27,5 @@ state,

});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []),
];
}
{
"name": "@react-hookz/web",
"version": "1.12.0",
"version": "1.13.0",
"description": "React hooks done right, for browser and SSR.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -54,8 +54,12 @@ # ![@react-hookz/web](.github/logo.png)

- #### Lifecycle
- [`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.
- [`useIsMounted`](https://react-hookz.github.io/web/?path=/docs/lifecycle-useismounted)
— Returns function that yields current mount state.
- [`useRerender`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usererender)

@@ -67,9 +71,6 @@ — Return callback that re-renders component.

— Effect hook that ignores the first render (not invoked on mount).
- [`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.
- #### State
- [`useToggle`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usetoggle)
— Like `useState`, but can only become `true` or `false`.
- [`useMediatedState`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usemediatedstate)
— Like `useState`, but every value set is passed through a mediator function.
- [`usePrevious`](https://react-hookz.github.io/web/?path=/docs/lifecycle-useprevious)

@@ -79,3 +80,4 @@ — Returns the value passed to the hook on previous render.

— Like `useState`, but its state setter is guarded against sets on unmounted component.
- [`useMediatedState`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usemediatedstate)
— Like `useState`, but every value set is passed through a mediator function.
- [`useToggle`](https://react-hookz.github.io/web/?path=/docs/lifecycle-usetoggle)
— Like `useState`, but can only become `true` or `false`.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc