Flow: Can't use React as a global variable

Created on 20 Aug 2016  路  2Comments  路  Source: facebook/flow

After defining React as a global variable, I added these lines to my global declarations

import type { React as ReactType } from 'react';
declare var React : ReactType;

After this, Flow no longer complains about not being able to resolve the React identifier, however all PropType checking is disabled.

How can I tell Flow that React is a globally defined import?

Most helpful comment

You can use the following to declare a global for React.

declare var React: $Exports<'react'>;

All 2 comments

You can use the following to declare a global for React.

declare var React: $Exports<'react'>;

God it took me hours/days to find this issue! Huge thumbs up to @aackerman :+1:

Was this page helpful?
0 / 5 - 0 ratings