UNPKG

614 BJavaScriptView Raw
1/**
2 * Copyright (c) 2013-present, Facebook, Inc.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 */
8
9'use strict';
10
11var shallowEqual = require('fbjs/lib/shallowEqual');
12
13/**
14 * Does a shallow comparison for props and state.
15 * See ReactComponentWithPureRenderMixin
16 * See also https://facebook.github.io/react/docs/shallow-compare.html
17 */
18function shallowCompare(instance, nextProps, nextState) {
19 return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
20}
21
22module.exports = shallowCompare;
\No newline at end of file