我接下来在学习,打字稿,redux。
为了在下一步中应用 redux,在谷歌搜索之后,我写了这样的代码。
但我不知道错误的含义是什么以及我必须做什么。
import App from "next/app";
import Head from 'next/head';
/*redux*/
import withRedux from 'next-redux-wrapper';
import { Provider } from 'react-redux';
import initialStore from '../redux/store';
export default withRedux(initialStore)(class MyApp extends App{
static async getInitialProps ({Component, ctx}:any) {
return {
pageProps: (Component.getInitialProps ? await Component.getInitialProps(ctx) : {})
}
}
render() {
const { Component, store } = this.props;
return(
<Provider store={store}>
<AppLayout>
<Component />
</AppLayout>
</Provider>
)
}
})
Run Code Online (Sandbox Code Playgroud)
这是我的代码
错误消息是
Property 'store' does not exist on type 'Readonly<AppInitialProps …Run Code Online (Sandbox Code Playgroud)