5 ms·
Don't you have React.PropTypes.shape({ foo: React.PropTypes.string, bar: React.PropTypes.shape({ fieldNum: React.PropTypes.number }) })
by berfarah 10y ago
Don't you have
React.PropTypes.shape({
foo: React.PropTypes.string,
bar: React.PropTypes.shape({
fieldNum: React.PropTypes.number
})
})
? I'm not saying it isn't verbose, but I'm pretty sure that as of a few months ago, this existed in React natively.
- sync 10y agoPropType support is pretty iffy, see e.g. https://github.com/facebook/react/issues/1833#issuecomment-148297807 https://github.com/facebook/react/issues/1833#issuecomment-1...
- ENGNR 10y agoYou can also do ImageUser.propTypes = { image: CustomImage.propTypes }
- mpawelski 10y agoThanks, I didn't know that (I've been using React.js just a month, and from beginning with TypeScript)