zoukankan      html  css  js  c++  java
  • [React] Choose the Right Hook for Your Recoil State

    Recoil offers several hooks to use for consuming state in React, and this lesson looks at how to choose which hook to use, and what happens when you don't use the right hook (hint: extra renders).

    The three basic RecoilJS hooks are:

    1. useRecoilState, which is great for reading and writing state,
    2. useRecoilValue, ideal for reading state, and
    3. useSetRecoilState, the primary candidate when you just need to write state.

    useRecoilState will trigger rerender of the component every time

    useSetRecoilState only trigger once

  • 相关阅读:
    类数组及其转换
    数组去重
    ios UIView
    ios 解决Wkwebview闪烁问题
    ios Https问题
    UUID
    JavaScript4
    JavaScript2
    JavaScript1
    UIScollView
  • 原文地址:https://www.cnblogs.com/Answer1215/p/13737465.html
Copyright © 2011-2022 走看看