I'm implementing redux into a new project, and everything has gone well up until I've connected the app using connect()(App). I'm getting the following Typescript error and can't seem to figure how to type it correctly.
(13,16): Property 'dispatch' does not exist on type 'Readonly<{ children?: ReactNode; }> & Readonly<{}>'.
The following is my app code.
import * as React from 'react';
import { connect } from 'react-redux';
import { handleInitialData } from '../../actions/shared';
import './App.css';
const logo = require('./logo.svg');
class App extends React.Component {
componentDidMount() {
this.props.dispatch(handleInitialData());
}
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<p className="App-intro">
To get started, edit <code>src/App.tsx</code> and save to reload.
</p>
</div>
);
}
}
export default connect()(App);