What is React proptype array with shape?
If you want to pass an array of objects to a component with a particular shape then use React.PropTypes.shape()
as an argument to React.PropTypes.arrayOf()
.
ReactComponent.propTypes = {arrayWithShape: React.PropTypes.arrayOf(React.PropTypes.shape({color: React.PropTypes.string.isRequired,fontSize: React.PropTypes.number.isRequired,}),).isRequired,};
December 28, 2021
506
Read more
What is React?
November 06, 2022
ReactJSHow to programmatically trigger click event in React?
November 06, 2022
ReactJS