Registry / testing / react-addons-pure-render-mixin

react-addons-pure-render-mixin

JSON →
library15.6.3jsnpmunverified

Legacy React addon providing a pure render mixin for shallow comparison of props and state. Current stable version 15.6.3. No longer maintained; recommended migration path is to use React.PureComponent. This package exists only for backwards compatibility and should not be used in new code. It is part of the deprecated React addons collection.

npm install react-addons-pure-render-mixin
INSTALL
IMPORT
SIG · REACT-ADDONS-PURE-
R
react-addons-pure-render-mixin
testingjavascriptv15.6.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PureRenderMixin
✓ import PureRenderMixin from 'react-addons-pure-render-mixin'
✗ import { PureRenderMixin } from 'react-addons-pure-render-mixin'
Default import, not named. Named import does not exist.
PureRenderMixin (CommonJS)
✓ const PureRenderMixin = require('react-addons-pure-render-mixin')
✗ const { PureRenderMixin } = require('react-addons-pure-render-mixin')
CommonJS require returns the default export directly.
React.addons.PureRenderMixin
✓ React.addons.PureRenderMixin
✗ window.React.addons.PureRenderMixin
Available when using the UMD bundle; React must be loaded first.

Shows how to use PureRenderMixin with createReactClass to optimize re-renders via shallow prop/state comparison.

const createReactClass = require('create-react-class'); const PureRenderMixin = require('react-addons-pure-render-mixin'); const MyComponent = createReactClass({ mixins: [PureRenderMixin], render() { return <div className={this.props.className}>foo</div>; } });
Debug
Known issues
deprecatedThis package is deprecated and no longer maintained. Do not use in new code.
fix
Migrate to React.PureComponent or React.memo for function components.
affects: >=0
gotchaOnly shallowly compares props and state; may produce false-negatives for nested data structures.
fix
Use immutable data structures or forceUpdate() when deep data changes.
affects: >=0
breakingIn React 16+, mixing PureRenderMixin with class components that extend React.Component will not work correctly; mixins are not supported.
fix
Convert to class extending React.PureComponent or use React.memo for functional components.
affects: >=16.0
Errors
Common errors & fixes
TypeError: (0 , _reactAddonsPureRenderMixin.default) is not a function
Importing named export instead of default export.
fix
Use 'import PureRenderMixin from ...' without braces.
Warning: React.createClass is no longer supported. Use React.createReactClass instead
Using React.createClass with PureRenderMixin in React 16+.
fix
Use 'create-react-class' package and require/createReactClass.
Upgrade
Version history
15.6.3latest on npm
Audit
Dependencies
reactrequiredpeer dependency required for React-specific functionality
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
react-addons-pure-render-mixin — npm install react-addons-pure-render-mixin · libregistry