摘要:
useCallback returns a memoized callback. const memoizedCallback = useCallback(function, arrayDependency) const App = () => { const [age, setAge] = use 阅读全文
摘要:
returns a 'ref' object. const refContainer = useRef(initialValueToBePersisted) Value is persisted in the refContainer.current property. values are acc 阅读全文
摘要:
useReducer may be used as an alternative to useState. const [state, dispatch] = useReducer(reducer, initialState, lazyInitFunction) Ideal for complex 阅读全文
摘要:
useContext saves you the stress of having to rely on a Context consumer. const contextValue = useContext(contextObject) // consuming context via a con 阅读全文
摘要:
useEffect accepts a function which can perform any side effects. useEffect(effectFunction, arrayDependencies) 每次绘制都执行 Without an array dependency, the 阅读全文
摘要:
useState lets you use local state within a function component. The setState function is used to update the state. It accepts a new state value and enq 阅读全文