react-router-prop-types

Runtime type checking for react-router props

react-router-prop-types

Runtime type checking for react-routerprops

Installation

npm install react-router-prop-types --save

Usage

import React from 'react';
import ReactRouterPropTypes from 'react-router-prop-types';

class MyComponent extends React.Component {
  static propTypes = {
    // You can chain any of the above with `isRequired` to make sure a warning
    // is shown if the prop isn't provided.
    history: ReactRouterPropTypes.history.isRequired,
    location: ReactRouterPropTypes.location.isRequired,
    match: ReactRouterPropTypes.match.isRequired,
    route: ReactRouterPropTypes.route.isRequired, // for react-router-config
  }
  render() {
    // ...
  }
}

HomePage

https://github.com/Javascript-Ninja/react-router-prop-types#readme

Repository

https+https://github.com/Javascript-Ninja/react-router-prop-types


上一篇:react-tweet-embed
下一篇:react-ideal-image

相关推荐

官方社区

扫码加入 JavaScript 社区