Using a counter app, Charlotte distinguishes React elements from fibers. JSX creates React element objects, and React uses them to build a fiber tree that stores component props, state, and other rendering information. React keeps the fibers between renders; React elements are temporary.
Build Your Mental Model of React’s Rendering Behavior
Speaker
Charlotte Isambert, React Native Tech Lead at BAM, explains React's rendering behavior at React Native EU 2023.
When the counter button calls setState, React creates a work tree and flags the Counter fiber for an update. Charlotte describes two checks: a component renders if it was flagged or if its props differ from the previous render. Since Counter creates new elements for Value and Button, their props change and they render too.
Charlotte simplifies the process into three causes: the component's state changed, its parent rendered, or a context value it uses changed. A child with no props can still render when its parent creates it again, because a new empty props object has a different reference. React.memo can prevent that render by comparing props shallowly.
When Counter receives Title as a prop and reuses the same React element, a Counter state update does not create a new Title fiber, so Title does not render. The same applies to elements passed under other prop names. If the component that created the element renders again, it creates a new element and Title can render.
Charlotte considers returning a Counter element created outside its parent. Reusing that element can avoid a child render when the parent renders, but she recommends React.memo for heavy components and notes that the technique only works with static props. If the same element is returned twice, React creates separate fibers, so each counter has independent state.
Takeaways
- Use the fiber tree as your mental model for which components React may render.
- A parent render usually causes its JSX-created children to render, even when their props look empty.
- Use React.memo when shallowly equal props should let a child skip rendering.
- Passing a previously created element as a prop can keep it from rendering when the receiving parent updates.
- Reusing one React element in two positions still gives each position its own fiber and state.
Mentioned in this talk
Search inside this talk
What was claimed 5
- role atCharlotte Isambert is full-time React Native tech lead at BAM
“I'm Charlotte, a React Native Tech Lead at BAM”
YouTube Verified2 sources· Talk
- featureReact: Keeps component data, props, and state in memory to inform renderingKeeps component data, props, and state in memory to inform rendering
“The fiber tree keeps in memory, through time, information about our components: their data, their props, and their state.”
YouTube Unverified1 source· Talk
- featureJSX: Creates React elements from component syntaxCreates React elements from component syntax
“JSX is actually just syntactic sugar.”
YouTube Unverified1 source· Talk
- featureReact: Creates fibers from React elements and stores component information across rendersCreates fibers from React elements and stores component information across renders
“A fiber is just an object as well that holds information about one component through renders.”
YouTube Unverified1 source· Talk
- featureReact: Memoized components use shallow equality on props to decide whether to renderMemoized components use shallow equality on props to decide whether to render
“We're going to compare the props through shallow equality this time, not strict equality.”
YouTube Unverified1 source· Talk










