react-hooks icon indicating copy to clipboard operation
react-hooks copied to clipboard

Collection of react hooks

Results 27 react-hooks issues
Sort by recently updated
recently updated
newest added

比如有一个请求 getData('post', { params: {} // 请求地址?后面拼接的参数 data: {} // body中的参数 }) 这两中参数都要传过去,useRequest 和 useRequestCallback 就没办法区别两种类型的参数,会全部拼接到?后面

https://github.com/ecomfe/react-hooks/blob/8d89a72ea22b6591b9cb226e8378e8ba7cc1e1c2/packages/request/src/index.ts#L104-L107 Usage: ``` function DeleteButton ({segmentId, refresh}) { const [delete, {pending}] = useRequestCallback(deleteSegment, {segmentId}); const onClick = async () => { if (await confirm(message)) { await delete(); //

## 目标 通过hooks简化弹窗类组件的调用。 ## 现状 实现弹窗交互时我们通常写出这样的代码。当组件需求越来越复杂,或者一个页面中出现多个弹窗时,这样的写法使得组件内 state 满天飞,可维护性急剧下降。同时,打开弹窗操作所引起的 state 更新会导致整个组件刷新,照成性能问题。 ```jsx function Demo() { const [editId, setEditId] = useState(); const [editField, setEditField] = useState(); const EditorDialog = fieldToEditorMap[editField]; const openEditor...

When I want to get some search params, I find that useSearchParam is too complex.So I write this hook to simplify code. e.g. ```typescript // before: use useSearchParam const Component...

【immerjs】Since version 6, support for the fallback implementation has to be explicitly enabled by calling enableES5() [documentation](https://immerjs.github.io/immer/installation)

add document to README Fixes #90

https://github.com/ecomfe/react-hooks/blob/8d89a72ea22b6591b9cb226e8378e8ba7cc1e1c2/packages/request/src/index.ts#L163-L166 Expacted: ``` const resultFixedForEffect = { ...result, pending: result.pendingCount === undefined ? true : result.pending, + request, }; ``` So that I can trigger request automatically as well as...

Inspired by https://github.com/react-component/field-form/blob/master/src/utils/valueUtil.ts#L120