react-router-prop-types
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

react-router-prop-types

Runtime type checking for react-router props

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() {
    // ...
  }
}

Package Sidebar

Install

npm i react-router-prop-types

Weekly Downloads

34,949

Version

1.0.5

License

MIT

Unpacked Size

9.66 kB

Total Files

5

Last publish

Collaborators

  • javascript-ninja