React useEffect in depth / use of useEffect?

后端 未结 3 1587
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-28 16:05

I am trying to understand the useEffect hook in-depth.

I would like to know when to use which method and why?

1.useEffect with no second         


        
3条回答
  •  无人及你
    2020-11-28 16:27

    3.useEffect with some arguments passed in the second parameter useEffect(()=>{},[arg])

    it will run first then it will run again if arg change

    Your forget also to ask what about the return inside the useEffect... Its uses for cleanup it will run when component dismount

提交回复
热议问题