Answers for "proptypes array of objects"

3

proptypes array of objects

MyComponent.propTypes = {
  items: PropTypes.arrayOf(
    PropTypes.shape({
      code: PropTypes.string,
      id: PropTypes.number,
    })
  ),
};
Posted by: Guest on September-03-2020
2

proptypes shape

PropTypes.shape({ name: PropTypes.string, age: PropTypes.number })
Posted by: Guest on December-28-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
0

proptypes.arrayof/()

optionalArrayOf: PropTypes.arrayOf(PropTypes.number)
Posted by: Guest on January-17-2021
4

react propthpes or

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

Code answers related to "proptypes array of objects"

Browse Popular Code Answers by Language