Projekt

Obecné

Profil

Stáhnout (2.41 KB) Statistiky
| Větev: | Revize:
1
# hoist-non-react-statics
2

    
3
[![NPM version](https://badge.fury.io/js/hoist-non-react-statics.svg)](http://badge.fury.io/js/hoist-non-react-statics)
4
[![Build Status](https://img.shields.io/travis/mridgway/hoist-non-react-statics.svg)](https://travis-ci.org/mridgway/hoist-non-react-statics)
5
[![Coverage Status](https://img.shields.io/coveralls/mridgway/hoist-non-react-statics.svg)](https://coveralls.io/r/mridgway/hoist-non-react-statics?branch=master)
6
[![Dependency Status](https://img.shields.io/david/mridgway/hoist-non-react-statics.svg)](https://david-dm.org/mridgway/hoist-non-react-statics)
7
[![devDependency Status](https://img.shields.io/david/dev/mridgway/hoist-non-react-statics.svg)](https://david-dm.org/mridgway/hoist-non-react-statics#info=devDependencies)
8

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

    
13
```bash
14
$ npm install --save hoist-non-react-statics
15
```
16

    
17
## Usage
18

    
19
```js
20
import hoistNonReactStatics from 'hoist-non-react-statics';
21

    
22
hoistNonReactStatics(targetComponent, sourceComponent);
23
```
24

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

    
27
```js
28
hoistNonReactStatics(targetComponent, sourceComponent, { myStatic: true, myOtherStatic: true });
29
```
30

    
31
## What does this module do?
32

    
33
See this [explanation](https://facebook.github.io/react/docs/higher-order-components.html#static-methods-must-be-copied-over) from the React docs.
34

    
35
## Compatible React Versions
36

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

    
39
| hoist-non-react-statics Version | Compatible React Version |
40
|--------------------------|-------------------------------|
41
| 3.x | 0.13-16.x With ForwardRef Support |
42
| 2.x | 0.13-16.x Without ForwardRef Support |
43
| 1.x | 0.13-16.2 |
44

    
45
## Browser Support
46

    
47
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.
48

    
49
## License
50
This software is free to use under the Yahoo Inc. BSD license.
51
See the [LICENSE file][] for license text and copyright information.
52

    
53
[LICENSE file]: https://github.com/mridgway/hoist-non-react-statics/blob/master/LICENSE.md
54

    
55
Third-party open source code used are listed in our [package.json file]( https://github.com/mridgway/hoist-non-react-statics/blob/master/package.json).
(3-3/4)