Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FlowType React Context

Tags:

flowtype

Is there a way to make React Context type-safe with flow type?

For example :

Button.contextTypes = {
  color: React.PropTypes.string
};
like image 344
jhegedus Avatar asked Nov 28 '16 21:11

jhegedus


People also ask

What is componenttype in React?

Element<typeof Component> is also the return type of React. createElement() . A React.Element<typeof Component> takes a single type argument, typeof Component . typeof Component is the component type of the React element. For an intrinsic element, typeof Component will be the string literal for the intrinsic you used.

What is react native flow?

Flow is a framework that, like TypeScript, promotes static typing in JavaScript. And like TypeScript it ships with React Native without any issues.


1 Answers

Unfortunately, it is inherently not possible because Context is not known at compile time (so I was told).

like image 151
jhegedus Avatar answered Oct 05 '22 17:10

jhegedus