katanyoo
2/24/2018 - 2:49 AM

proptypes.js

// ============ Before (15.4 and below)
import React, { Component, PropTypes } from 'react';

class App extends Component {
  render() {
    return (
      <div>{this.props.text}</div>
    );
  }
}

App.propTypes = {
  text: PropTypes.string.isRequired
};

// ============ After (15.5)
import React, { Component } from 'react';
import PropTypes from 'prop-types';

class App extends Component {
  render() {
    return <div>{this.props.text}</div>;
  }
}

App.propTypes = {
  text: PropTypes.string.isRequired,
};