Support referenced and imported propTypes
See original GitHub issuegivent
import React from 'react';
const user = React.PropTypes.shape({
email_address: React.PropTypes.string,
name: React.PropTypes.string,
})
export default class Foobar extends React.Component {
static propTypes = {
a1: user,
a2: React.PropTypes.shape({
email_address: React.PropTypes.string,
name: React.PropTypes.string,
})
};
render() { return (<p>.</p>); }
};
the a1 field is renders to ‘No Control available’ while a2 appropriately renders the expected form.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Add support for imported propTypes · Issue #33 - GitHub
Importing prop types is a fairly common use case which doesn't appear to be possible at this stage. Any plans to support this...
Read more >PropTypes import for React is not recognized on class ...
Does anyone have any idea why I can't access .propType on my class? import React from 'react'; import PropTypes from ...
Read more >Mastering Props And PropTypes In React - Smashing Magazine
This tutorial will introduce you to the details about props, passing and accessing props, and passing information to any component using props.
Read more >Don't Call PropTypes Warning - React
Don't call PropTypes directly Using PropTypes in any other way than annotating React components with them is no longer supported: var apiShape =...
Read more >React Pattern: Centralized PropTypes - freeCodeCamp
Avoid repeating yourself by centralizing PropTypes There are three ... I use a named import to get a reference to the exported PropType...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fkling / @nikgraf that does appear to fix this, FWIW
@fkling cool, thx for the hint. I will look into it later this week and create a PR 😊