What's the difference between React $ Element and ReactElement

I am trying to use stream with ReactJS. I need to add a type to support children. The article ( Flow + React ) doesn't say anything about this.

I found many examples that use ReactElement ( for example ). But the stream speaks identifier ReactElement. Could not resolve name

. I am using React $ Element & lt; *> and it works.

Question. How is React $ Element different from ReactElement? And where can I find information about React $ Element? Where is the search type definition thread.

+3


source to share


1 answer


React$Element

is currently in the 'act.js' library file bundled with Flow :

/**
 * Type of a React element. React elements are commonly created using JSX
 * literals, which desugar to React.createElement calls (see below). The type
 * parameterization of React$Element mimics that of ReactClass (see above).
 */
declare class React$Element<Config> {
  type: ReactClass<Config>;
  props: $PropsOf<Config>;
  key: ?string;
  ref: any;
}

      



This may eventually move to a new stream / repository with a stream type , as mentioned by the Flow team in their blog on Stream Type View . If you want definitions for libraries that you install from NPM, you have to search the thread.

+1


source







All Articles