Answers for "Prop validation in React"

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
4

react propthpes or

size: PropTypes.oneOfType([
  PropTypes.string,
  PropTypes.number
]),
Posted by: Guest on April-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language