Answers for "react proptypes jsdoc"

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
0

proptypes for a react component

//You can now use `PropTypes.elementType`
// to validate for Component type props
Posted by: Guest on July-07-2021

Browse Popular Code Answers by Language