1.1.19 • Published 8 months ago

powerful-hooks v1.1.19

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

powerful-hooks

NPM version NPM downloads

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

8 months ago

1.1.18

8 months ago

1.1.17

8 months ago

1.1.16-beta

8 months ago

1.1.16

9 months ago

1.1.5-beta

9 months ago

1.1.15

9 months ago

1.1.4

9 months ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1-beta

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago