hoist-non-react-statics

Copies non-react specific statics from a child component to a parent component

BSD-3-Clause 33 个版本
安装
npm install hoist-non-react-statics
yarn add hoist-non-react-statics
pnpm add hoist-non-react-statics
bun add hoist-non-react-statics
README

hoist-non-react-statics

NPM version Build Status Coverage Status Dependency Status devDependency Status

Copies non-react specific statics from a child component to a parent component. Similar to Object.assign, but with React static keywords blacklisted from being overridden.

$ npm install --save hoist-non-react-statics

Usage

import hoistNonReactStatics from 'hoist-non-react-statics';

hoistNonReactStatics(targetComponent, sourceComponent);

If you have specific statics that you don't want to be hoisted, you can also pass a third parameter to exclude them:

hoistNonReactStatics(targetComponent, sourceComponent, { myStatic: true, myOtherStatic: true });

What does this module do?

See this explanation from the React docs.

Compatible React Versions

Please use latest 3.x. Versions prior to 3.x will not support ForwardRefs.

hoist-non-react-statics Version Compatible React Version
3.x 0.13-16.x With ForwardRef Support
2.x 0.13-16.x Without ForwardRef Support
1.x 0.13-16.2

Browser Support

This package uses Object.defineProperty which has a broken implementation in IE8. In order to use this package in IE8, you will need a polyfill that fixes this method.

License

This software is free to use under the Yahoo Inc. BSD license. See the LICENSE file for license text and copyright information.

Third-party open source code used are listed in our package.json file.

版本列表
3.3.2 2020-01-22
3.3.1 2019-11-14
3.3.0 2019-01-23
3.2.1 2018-12-03
3.2.0 2018-11-26
3.1.0 2018-10-30
3.0.1 2018-07-28
3.0.0-rc.1 2018-07-18
3.0.0-rc.0 2018-07-05
3.0.0 2018-07-26
2.5.5 2018-06-18
2.5.4 2018-06-11
2.5.3 2018-06-08
2.5.2 2018-06-08
2.5.1 2018-06-08
2.5.0 2018-02-16
2.3.1 2017-08-30
2.3.0 2017-08-17
2.2.2 2017-08-08
2.2.1 2017-07-24
2.2.0 2017-07-13
2.1.1 2017-07-12
2.1.0 2017-07-10
2.0.0 2017-06-26
1.2.0 2016-06-17
1.1.0 2016-06-13
1.0.6 2016-05-11
1.0.5 2016-02-02
1.0.4 2016-02-02
1.0.3 2015-08-10
1.0.2 2015-06-08
1.0.1 2015-05-30
1.0.0 2015-05-27