1
const CustomComponent = function(props) {
  console.log(props.size)
  return (...)
}

CustomComponent.defaultProps = {
  size: 64,
  ...
}

CustomComponent.propTypes = {
  size: PropTypes.number,
  ...
}

This is my custom component, size is undefined when this component is rendered. I don't understand why default props is not assigned to size props in this component.

Bo King
  • 62
  • 6

0 Answers0