You Might Not Need an Effect

See https://react.dev/learn/you-might-not-need-an-effect

useEffect can lead to clunky code, as well as performance issues.

What other alternatives do we have?

  1. Quite often, we will be able to achieve the same functionality by adding the logic straight in the jsx or by setting up an extra function in the Component.
  2. For data fetching, replace useEffect with libraries
    1. These libraries also take care of things like caching and synchronization
    2. react-query
    3. rtk query
    4. swr or next.js

Links to this note