Reputation: 6345
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
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
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