-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Question: propTypes? #77
Comments
At least for me, I like to have const _propTypes = { children: React.PropTypes.string };
const _defaultProps = { children: 'Hello World!' };
const Text = ({children}) => (
<p>{children}</p>
);
export default compose(
setPropTypes: _propTypes,
setDefaultProps: _defaultProps
)(Text) Where const setDefaultProps = setStatic('defaultProps') It makes more sense when you have a lot of I'd be curious to see what other patterns people are using! |
I feel embarassed, I didn't see this function in the API documentation. Should have cmd+F'ed for @mrblueblue: both your method and the one using the Keeping issue open for the sake of discussion, feel free to close it Andrew if you consider it resolved. |
I believe the long term plan for React is to deprecate |
I know this is closed, but @acdlite do you have flow definitions somewhere? |
I'd be interested also to know how to use for example Edit: found this PR #241 - nevermind :) |
@acdlite is recompose now compatible with Flow's React integration? https://flow.org/en/docs/frameworks/react/ In other words, can we omit |
I love this.
My only question about using function components, how do you specify
propTypes
? For documentation purposes chiefly, but they also help catch stupid mistakes.This works but it doesn't look that great:
I saw that you use Flow type notation in the documentation. Is that a possible route? Replacing propTypes with Flow annotations entirely?
The text was updated successfully, but these errors were encountered: