I’m using a data object as my props for a component in ReactJS.

<Field data={data} />

I know its easy to validate the PropTypes object itself:

propTypes: {
  data: React.PropTypes.object
}

But what if I want to validate the values inside? ie. data.id, data.title?

props[propName]: React.PropTypes.number.required // etc...

4 Answers
4

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *