1.1.19 • Published 3 days ago
powerful-hooks v1.1.19
powerful-hooks
More powerful React hooks
It's a state hook that can remember your initial value.
// 可重置的state。
import { useMemoState } from 'powerful-hooks';
const [state, setState, resetState] = useMemoState(initValue);
// 如同在类组件中的setState使用方式,同样支持重置。
import { useSetState } from 'powerful-hooks';
const [state, setState, resetState] = useSetState(initValue);
// fetch请求。
import { useGet, usePost, usePut, useDelete } from 'powerful-hooks';
const { data, loading, run } = useGet({
url: '/api/url',
data: { key: 'value' },
headers: { key: 'value' },
handler: (responens) => {},
manual: true,
});
// 获取url中的query参数。
import { useUrlQuery } from 'powerful-hooks';
const { get, getAll } = useUrlQuery();
get('key');
getAll();
// 防抖函数
import { useDebounceFn } from 'powerful-hooks';
const debounceFn = useDebounceFn(fn, wait);
// 节流函数
import { useThrottleFn } from 'powerful-hooks';
const throttleFn = useThrottleFn(fn, wait);
// 防抖state
import { useDebounceState } from 'powerful-hooks';
const [state, setState] = useDebounceState(initialValue, wait);
// 节流state
import { useThrottleState } from 'powerful-hooks';
const [state, setState] = useThrottleState(initialValue, wait);
// float浮点数运算
import { useFloat } from 'powerful-hooks';
const { add, subtract, multiply, divide } = useFloat;
add(0.1, 0.2, 0.3); // 0.6
subtract(0.3, 0.2); // 0.1
multiply(0.3,0.77); // 0.231
divide(0.3, 3); // 0.1
1.1.19
3 days ago
1.1.18
17 days ago
1.1.17
19 days ago
1.1.16-beta
20 days ago
1.1.16
22 days ago
1.1.5-beta
1 month ago
1.1.15
29 days ago
1.1.4
1 month ago
1.1.3
9 months ago
1.1.2
9 months ago
1.1.1
10 months ago
1.1.0
10 months ago
1.0.15
11 months ago
1.0.14
11 months ago
1.0.13
11 months ago
1.0.11
11 months ago
1.0.10
11 months ago
1.0.9
11 months ago
1.0.8
11 months ago
1.0.7
11 months ago
1.0.6
11 months ago
1.0.5
11 months ago
1.0.4
11 months ago
1.0.3
11 months ago
1.0.2
11 months ago
1.0.1-beta
11 months ago
1.0.1
11 months ago
1.0.0
11 months ago