ReactJS, Calling setState with same parameter

前端 未结 3 1027
旧巷少年郎
旧巷少年郎 2021-01-07 16:45

I have been reading the React docs and came across shouldComponentUpdate(). My understanding is that everytime setState() is called, a re-render of

3条回答
  •  耶瑟儿~
    2021-01-07 17:18

    I dont know if I understood your question correctly but react only re renders when there is difference between virtual dom and real dom.

    And as Jyothi mentioned in his answer that render method will be called irrespective of the value passed in the set state function but rerendering will depend on what this render method returns.

提交回复
热议问题