Super Jade
Super Jade

Reputation: 6345

Module '"<file path>/react-redux"' has no exported member 'Dispatch'

I am following a TypeScript-React-Starter tutorial, and wrapping a component into a container, Hello.tsx. Line 4 is

import {connect, Dispatch} from 'react-redux';

and throws the following error on Dispatch:

Module '"../../node_modules/@types/react-redux"' has no exported member 'Dispatch'.


How do I import Dispatch?

Do I need to update something? npm install doesn't help, not even after updating to the latest npm version.

Upvotes: 3

Views: 3727

Answers (2)

Super Jade
Super Jade

Reputation: 6345

Module '"../../node_modules/@types/react-redux"' has no exported member 'Dispatch'.  


Looks like Dispatch is no longer part of react-redux; it's part of redux. Import Dispatch with

 import {Dispatch} from 'redux';

Keep connect with

import {connect} from 'react-redux';

Upvotes: 1

Murtaza Hussain
Murtaza Hussain

Reputation: 4285

This really a breaking change. Dispatch is part of "redux" instead of "react-redux".

import { connect } from "react-redux";
import { Dispatch } from "redux";

For more information visit TypeScript-React-Starter Issue

Upvotes: 1

Related Questions