A Collection of Higher-order ReactJS Components

React Decorators

A collection of higher-order React components

How to Install

npm/react-decorators

$ npm install react-decorators --save

How to Use

import React from 'react';
import withViewport from 'react-decorators/withViewport';

@withViewport
class MyComponent {
  render() {
    let { width, height } = this.props.viewport;
    return <div>Viewport: {width + 'x' + height}</div>;
  }
}

React.render(<MyComponent />, document.body);

More decorators coming soon…

Related Projects

Copyright

The MIT License © Konstantin Tarkus (@koistya), Kriasoft LLC

Download Details:

Author: kriasoft

Source Code: https://github.com/kriasoft/react-decorators

#react #reactjs #javascript

A Collection of Higher-order ReactJS Components
2.95 GEEK