UNPKG

set-state-compare

Version:

setState for React that compares with the current state and only sets the state if changed.

9 lines (7 loc) 268 B
import React from "react" import shouldComponentUpdate from "./should-component-update.js" export default class PureComponent extends React.Component { shouldComponentUpdate(nextProps, nextState) { return shouldComponentUpdate(this, nextProps, nextState) } }