Answers for "how to set Proptypes of object that is not required"

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
4

react propthpes or

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

Code answers related to "how to set Proptypes of object that is not required"

Code answers related to "Javascript"

Browse Popular Code Answers by Language