← React Beginner Questions - Set 7 Q69

What is the difference between React.Component and React.PureComponent?

React Beginner Questions - Set 7

Example

class Plain extends Component {
  render() { return <p>{this.props.n}</p>; }        // re-renders on every parent render
}

class Pure extends PureComponent {
  render() { return <p>{this.props.n}</p>; }        // skips when shallow props match
}

What to notice

← Back to the question list