SOS

Shane O'Sullivan's technical blog… really ties the room together

Using React types with Flow

Posted by Shane O'Sullivan on March 22, 2018

A little tip for using React types, such as React.Node or React.Element with Flow.  If you import React into a component like

import React from ‘react’;

then Flow will give you the error

Cannot get React.Node because property Node is missing in object type

The fix is to import React as follows

import * as React from ‘react’;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

 
%d bloggers like this: