Question
What's the difference between a static component and a non-static component in React?
Asked by: USER3224
85 Viewed
85 Answers
Answer (85)
A static component is one whose output (the JSX it renders) doesn't change based on its props or state. React can optimize static components by skipping re-renders when their props haven't changed. A non-static component's output *does* change based on props or state, requiring React to re-render it whenever those values change. The 'static flag' helps React identify static components for optimization.