Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # hoist-non-react-statics
  2. [![NPM version](https://badge.fury.io/js/hoist-non-react-statics.svg)](http://badge.fury.io/js/hoist-non-react-statics)
  3. [![Build Status](https://img.shields.io/travis/mridgway/hoist-non-react-statics.svg)](https://travis-ci.org/mridgway/hoist-non-react-statics)
  4. [![Coverage Status](https://img.shields.io/coveralls/mridgway/hoist-non-react-statics.svg)](https://coveralls.io/r/mridgway/hoist-non-react-statics?branch=master)
  5. [![Dependency Status](https://img.shields.io/david/mridgway/hoist-non-react-statics.svg)](https://david-dm.org/mridgway/hoist-non-react-statics)
  6. [![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)
  7. Copies non-react specific statics from a child component to a parent component.
  8. Similar to `Object.assign`, but with React static keywords blacklisted from
  9. being overridden.
  10. ```bash
  11. $ npm install --save hoist-non-react-statics
  12. ```
  13. ## Usage
  14. ```js
  15. import hoistNonReactStatics from 'hoist-non-react-statics';
  16. hoistNonReactStatics(targetComponent, sourceComponent);
  17. ```
  18. If you have specific statics that you don't want to be hoisted, you can also pass a third parameter to exclude them:
  19. ```js
  20. hoistNonReactStatics(targetComponent, sourceComponent, { myStatic: true, myOtherStatic: true });
  21. ```
  22. ## What does this module do?
  23. See this [explanation](https://facebook.github.io/react/docs/higher-order-components.html#static-methods-must-be-copied-over) from the React docs.
  24. ## Compatible React Versions
  25. Please use latest 3.x. Versions prior to 3.x will not support ForwardRefs.
  26. | hoist-non-react-statics Version | Compatible React Version |
  27. |--------------------------|-------------------------------|
  28. | 3.x | 0.13-16.x With ForwardRef Support |
  29. | 2.x | 0.13-16.x Without ForwardRef Support |
  30. | 1.x | 0.13-16.2 |
  31. ## Browser Support
  32. 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.
  33. ## License
  34. This software is free to use under the Yahoo Inc. BSD license.
  35. See the [LICENSE file][] for license text and copyright information.
  36. [LICENSE file]: https://github.com/mridgway/hoist-non-react-statics/blob/master/LICENSE.md
  37. 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).