react-shallow-equal

Efficient shallow equality algorithm for React and React Native

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-shallow-equal
100.1.16 years ago6 years agoMinified + gzip package size for react-shallow-equal in KB

Readme

react-shallow-equal · npm
Efficient shallow equality algorithm for React
and React Native.
This is a fork of lelandrichardson/shallow-element-equals.

Table of Contents

- propsEqual - elementsEqual - stylesEqual

Install

yarn add react-shallow-equal
  # or
npm install --save react-shallow-equal

Usage

import React, {PureComponent} from 'react';
import {propsEqual} from 'react-shallow-equal';

// ...

shouldComponentUpdate(nextProps) {
  return !propsEqual(this.props, nextProps);
}

// ...

API

propsEqual(a, b, options)

elementsEqual(a, b)

stylesEqual(a, b)

See lelandrichardson/style-equal
---