popkirby / react-props-decorators

Define props of React components by ES7 decorators

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-props-decorators

Define Component.propTypes and Component.defaultProps by ES7 decorators.

Installation

npm install react-props-decorators

Usage

import React from 'react';
import { propTypes, defaultProps } from 'react-props-decorators';

@propTypes({
  foo: React.PropTypes.string,
  bar: React.PropTypes.number
})
@defaultProps({
  foo: "defaultString",
  bar: 100
})
class Baz extends React.Component {
  /* ... */
}

License

MIT

About

Define props of React components by ES7 decorators


Languages

Language:JavaScript 100.0%