mirror of
https://github.com/streamich/react-use.git
synced 2025-12-08 18:02:14 +00:00
chore: 🤖 don't install only large dependencies
This change removes useCallbag hook, it also reverts back changes for
hooks that only have tiny dependencies or dependencies that could have
been part of the hook itself. Effectivly only KeyboardJS and Rebound are
large packages that only partially are used by react-use, hence require
user to install them separately.
BREAKING CHANGE: 🧨 useCallbag hook is removed, some hooks KeyboardJS and Rebound installed
separately
This commit is contained in:
parent
3d0a82f4ac
commit
61700675cd
@ -89,7 +89,6 @@
|
||||
<br/>
|
||||
- [**State**](./docs/State.md)
|
||||
- [`createMemo`](./docs/createMemo.md) — factory of memoized hooks.
|
||||
- [`useCallbag`](./docs/useCallbag.md) — tracks latest value of a callbag.
|
||||
- [`useGetSet`](./docs/useGetSet.md) — returns state getter `get()` instead of raw state.
|
||||
- [`useGetSetState`](./docs/useGetSetState.md) — as if [`useGetSet`](./docs/useGetSet.md) and [`useSetState`](./docs/useSetState.md) had a baby.
|
||||
- [`useObservable`](./docs/useObservable.md) — tracks latest value of an `Observable`.
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
# `useCallbag`
|
||||
|
||||
React state hook that tracks the latest value of a callbag.
|
||||
|
||||
Requires `use-callbag`:
|
||||
```bash
|
||||
npm add use-callbag
|
||||
# or
|
||||
yarn add use-callbag
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```jsx
|
||||
import {useCallbag} from 'react-use';
|
||||
import interval from 'callbag-interval';
|
||||
|
||||
const Demo = () => {
|
||||
const count = useCallbag(() => interval(1000));
|
||||
return <span>{`Counter: ${count}`}</span>
|
||||
};
|
||||
```
|
||||
@ -4,13 +4,6 @@ React side-effect hook that changes [CSS dynamically][gen-5]. Works like "virtua
|
||||
it re-renders only CSS rules that change. It is different from inline styles, because
|
||||
you can use media queries and pseudo selectors.
|
||||
|
||||
Requires `nano-css`:
|
||||
```bash
|
||||
npm add nano-css
|
||||
# or
|
||||
yarn add nano-css
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@ -2,13 +2,6 @@
|
||||
|
||||
React sensor hook that tracks if user on the page is idle.
|
||||
|
||||
Requires `throttle-debounce`:
|
||||
```bash
|
||||
npm add throttle-debounce
|
||||
# or
|
||||
yarn add throttle-debounce
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ via [KeyboardJS key combos](https://github.com/RobertWHurst/KeyboardJS).
|
||||
Check its documentation for further details on how to make combo strings.
|
||||
|
||||
Requires `keyboardjs`:
|
||||
|
||||
```bash
|
||||
npm add keyboardjs
|
||||
# or
|
||||
|
||||
@ -15,6 +15,7 @@ if a second and third argument are passed, the second will be used in the keyup
|
||||
event and the third in the keydown event. Essentially, keydown takes precedence.
|
||||
|
||||
Requires `keyboardjs`:
|
||||
|
||||
```bash
|
||||
npm add keyboardjs
|
||||
# or
|
||||
|
||||
@ -4,6 +4,7 @@ React UI hook that triggers a callback when user
|
||||
clicks outside the target element.
|
||||
|
||||
Requires `use-onclickoutside`:
|
||||
|
||||
```bash
|
||||
npm add use-onclickoutside
|
||||
# or
|
||||
|
||||
@ -4,6 +4,7 @@ React animation hook that updates a single numeric value over time according
|
||||
to spring dynamics.
|
||||
|
||||
Requires `rebound`:
|
||||
|
||||
```bash
|
||||
npm add rebound
|
||||
# or
|
||||
|
||||
@ -4,12 +4,6 @@ React animation hook that tweens a number between 0 and 1.
|
||||
|
||||
[](https://codesandbox.io/s/52990wwzyl)
|
||||
|
||||
Requires `ts-easing`:
|
||||
```bash
|
||||
npm add ts-easing
|
||||
# or
|
||||
yarn add ts-easing
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@ -2,12 +2,6 @@
|
||||
|
||||
`useWait` is a React Hook helps to manage multiple loading states on the page without any conflict. It's based on a very simple idea that manages an `Array` of multiple loading states. The built-in `Wait` component listens its registered loader and immediately become loading state.
|
||||
|
||||
Requires `react-wait`:
|
||||
```bash
|
||||
npm add react-wait
|
||||
# or
|
||||
yarn add react-wait
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
12
package.json
12
package.json
@ -30,16 +30,16 @@
|
||||
},
|
||||
"homepage": "https://github.com/streamich/react-use#readme",
|
||||
"dependencies": {
|
||||
"@types/react": "^16.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"keyboardjs": "^2.5.1",
|
||||
"nano-css": "^5.0.0",
|
||||
"react-wait": "^0.3.0",
|
||||
"rebound": "^0.1.0",
|
||||
"throttle-debounce": "^2.0.1",
|
||||
"ts-easing": "^0.2.0",
|
||||
"use-callbag": "^0.2.0",
|
||||
"use-onclickoutside": "^0.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^16.8.2",
|
||||
"keyboardjs": "^2.5.1",
|
||||
"rebound": "^0.1.0",
|
||||
"use-onclickoutside": "^0.3.0",
|
||||
"@semantic-release/changelog": "3.0.2",
|
||||
"@semantic-release/git": "7.0.8",
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
import useCallbag from 'use-callbag'
|
||||
|
||||
export default useCallbag;
|
||||
|
||||
12
yarn.lock
12
yarn.lock
@ -3101,11 +3101,6 @@ callbag-interval@1.1.0:
|
||||
dependencies:
|
||||
callbag "^1.1.0"
|
||||
|
||||
callbag-subscribe@^1.4.1:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/callbag-subscribe/-/callbag-subscribe-1.4.1.tgz#f9bd86b713230c9113acf6b7c5c6baf7d5ec772f"
|
||||
integrity sha512-FzvJK3ODP50UhZPhfCFwJZ+YP+Hg/6Fm1+d3m2UZacA1b+jSKARpyNTIpkWlf61rAHEgpwZF1head4URY+EEMw==
|
||||
|
||||
callbag@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/callbag/-/callbag-1.1.0.tgz#9cbbc3352832da43e764d588ed43121d4b09c42a"
|
||||
@ -11088,13 +11083,6 @@ url@^0.11.0:
|
||||
punycode "1.3.2"
|
||||
querystring "0.2.0"
|
||||
|
||||
use-callbag@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/use-callbag/-/use-callbag-0.2.0.tgz#bf3bbef918effc5818e0149f44d8b7385a7d03f1"
|
||||
integrity sha512-ml1cDc2ZwieqXv+AtgPZUl6UWmYN/4roZgBg+LgFrU1s8khdTVEaj44utQwughw5qJDxEZ1lIOrdWEJvbO6cMA==
|
||||
dependencies:
|
||||
callbag-subscribe "^1.4.1"
|
||||
|
||||
use-onclickoutside@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/use-onclickoutside/-/use-onclickoutside-0.3.0.tgz#a7c6bb68c8643c9a3437e34840d0cb2b96ae32b1"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user