Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Whenever I use
- ```js
- MyComponent.defaultProps = {
- ...something
- }
- ```
- after MyComponent is created by
- ```js
- class MyComponent extends Component {
- ...
- }
- ```
- flow gives the error:
- ```
- object literal. This type is incompatible with undefined
- Did you forget to declare type parameter `DefaultProps` of identifier `Component`
- ```
- This is type error. Flow has already inferred the type for your class before you try to mutate the defaultProps property.
- And since you didn't give it a type it was inferred as void. This should fix it:
- ```js
- class MyComponent extends Component {
- static defaultProps: Object;
- }
- ```
Add Comment
Please, Sign In to add comment