• Frontend
  • Hooks

Hooks

  • useState() hook to store simple data
  • useEffect() hook to replace componentDidMount() componentWillUnmount() and componentDidUpdate() to manage lifecycles
  • useContext() hook to allow you access global state by Context API of react
  • useReducer() hook to allow you use Redux-style code to manage state lifecycle
  • useCallback() hook to return memorized callback, here's a guide
  • useRef() hook to fold elements and mutable values
  • react hook utility such as react-use
    • useThrottle() and useDebounce() allows you to reduce frequent calls
  • SWR: A strategy to first return the data from cache (stale), then send the fetch request (revalidate), and finally come with the up-to-date data
Last updated on September 18, 2023