简体   繁体   中英

List of events, that cause React component to re-render

I want to know, what are events, that cause React component to re-render.

I couldn't find full list anywhere, it'd be great if someone writes the list of events, that cause React component to re-render.

I always find the following reference website helpful.

http://reactcheatsheet.com/

Filter by lifecycle events, and you can see the places where setState will trigger a rerender.

__

Update: you now have to filter by "misc"

React component is re-rendered when setState() is called or when props change. You can also force re-render with forceUpdate()

https://facebook.github.io/react/docs/component-api.html#forceupdate

By default, when your component's state or props change , your component will re-render. However, if these change implicitly (eg: data deep within an object changes without changing the object itself) or if your render() method depends on some other data, you can tell React that it needs to re-run render() by calling forceUpdate() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM