mirror of
https://github.com/streamich/react-use.git
synced 2025-12-08 18:02:14 +00:00
feat: bump useWait
This commit is contained in:
parent
6f86b9e4e1
commit
124ef993d9
@ -1,6 +1,6 @@
|
||||
# `useWait`
|
||||
|
||||
React waiting management hook.
|
||||
`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.
|
||||
|
||||
## Usage
|
||||
|
||||
@ -15,7 +15,7 @@ function UserCreateButton() {
|
||||
onClick={() => startWaiting("creating user")}
|
||||
disabled={isWaiting("creating user")}
|
||||
>
|
||||
<Wait message="creating user" waiting={<div>Creating user!</div>}>
|
||||
<Wait on="creating user" fallback={<div>Creating user!</div>}>
|
||||
Create User
|
||||
</Wait>
|
||||
</button>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
"ts-easing": "^0.1.0",
|
||||
"use-onclickoutside": "^0.1.0",
|
||||
"use-callbag": "^0.1.2",
|
||||
"use-wait": "^0.0.3"
|
||||
"react-wait": "^0.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@storybook/react": "^3.4.11",
|
||||
|
||||
@ -23,7 +23,7 @@ const Demo = () => {
|
||||
return (
|
||||
<div>
|
||||
<button disabled={isWaiting('creating user')} onClick={createUser}>
|
||||
<Wait message="creating user" waiting={<b>Creating User...</b>}>
|
||||
<Wait on="creating user" fallback={<b>Creating User...</b>}>
|
||||
Create User
|
||||
</Wait>
|
||||
</button>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Waiter, useWait } from 'use-wait'
|
||||
import { Waiter, useWait } from 'react-wait'
|
||||
|
||||
useWait.Waiter = Waiter;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user