We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For functional components we can use React.Config to define default props:
React.Config
import * as React from 'react'; type DefaultProps = $ReadOnly<{ /** Description for defaultProp. */ defaultProp: number, }>; type AllProps = $ReadOnly<{ ...DefaultProps, /** Description for optionalProp. */ optionalProp?: number, /** Description for requiredProp. */ requiredProp: number, }>; type Props = React.Config<AllProps, DefaultProps>; export default function Component({ defaultProp = 0, optionalProp, requiredProp, }: Props) { return <div />; }
But react-docgen fails to parse all the props properly. It only parses the default prop but not the other two props.
react-docgen
{ "description": "", "displayName": "Component", "methods": [], "props": { "defaultProp": { "defaultValue": { "value": "0", "computed": false }, "required": false }, "optionalProp": { "defaultValue": { "value": "0", "computed": false }, "required": false } } }
The text was updated successfully, but these errors were encountered:
Is this a flow or typescript feature?
Sorry, something went wrong.
This is a flow feature. See reference here: https://flow.org/en/docs/react/types/#toc-react-config
No branches or pull requests
For functional components we can use
React.Config
to define default props:But
react-docgen
fails to parse all the props properly. It only parses the default prop but not the other two props.The text was updated successfully, but these errors were encountered: