0
0
Reactframework~5 mins

Re-rendering behavior in React - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What causes a React component to re-render?
A React component re-renders when its state or props change. This means React updates the component's output to match the new data.
Click to reveal answer
beginner
How does React decide if a component should update?
React compares the new props and state with the previous ones. If they are different, React re-renders the component to update the UI.
Click to reveal answer
intermediate
What is the role of React.memo in re-rendering?
React.memo is a function that wraps a component to prevent unnecessary re-renders. It only re-renders if the props change, improving performance.
Click to reveal answer
intermediate
Why can changing state with the same value still cause a re-render?
React re-renders because it does not deeply compare state values. Even if the value looks the same, setting state triggers a re-render by default.
Click to reveal answer
intermediate
How can useCallback help with re-rendering?
useCallback returns a memoized function that keeps the same reference between renders. This helps prevent child components from re-rendering when functions are passed as props.
Click to reveal answer
What triggers a React component to re-render?
AChange in HTML outside React
BChange in CSS styles only
CChange in unrelated variables
DChange in state or props
What does React.memo do?
AForces re-render every time
BPrevents re-render if props are unchanged
CRemoves component from DOM
DChanges state automatically
Which hook helps keep function references stable to avoid re-renders?
AuseCallback
BuseState
CuseEffect
DuseRef
If you set state to the same value, what happens?
AComponent never re-renders
BComponent crashes
CComponent re-renders anyway
DState resets to initial
How does React check if it should re-render a component?
ABy comparing new and old props and state
BBy checking CSS changes
CBy checking DOM changes outside React
DBy user input only
Explain in simple terms what causes a React component to re-render and why this is important.
Think about what happens when data changes in your app.
You got /4 concepts.
    Describe how React.memo and useCallback help improve performance by controlling re-rendering.
    Consider how React decides to update components and how to avoid extra work.
    You got /4 concepts.