Flow: An inexplicable error hint: parameter `props` Missing annotation

Created on 9 Sep 2017  ·  1Comment  ·  Source: facebook/flow

export default class AwesomeProject extends React.Component {

  constructor(props) {  //this is the Error content:  parameter `props` Missing annotation  
    super(props);
    this.state = { content: '无数据' };  // Error: object literal This type is incompatible with undefined. Did you forget to declare type parameter `State` of property `Component`?

  }
...
}

How can I fix it?

>All comments

You need to provide a type annotation on the props argument to constructor. For example, if props just takes a string under "name", it might look like:

constructor(props: {name: string}){
Was this page helpful?
0 / 5 - 0 ratings