Answers for "react set prop types"

-1

prop-types

npm install --save prop-types
Posted by: Guest on December-23-2020
3

react proptypes

import PropTypes from 'prop-types';

class Greeting extends React.Component {
  render() {
    return (
      <h1>Hello, {this.props.name}</h1>
    );
  }
}

Greeting.propTypes = {
  name: PropTypes.string
};
Posted by: Guest on August-27-2020

Browse Popular Code Answers by Language