我在ES6中进行解构时收到以下错误。 我想知道什么是正确的流程注释来防止此错误。
消息:'解构(缺少注释)'来源:'流程'
import React from 'react'
import { Provider } from 'react-redux'
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
import Forecast from './Forecast'
import Map from './Map'
const Root = ({ store }) => ( //<<<< ERROR HERE
<Provider store={store}>
<Router>
<Switch>
<Route exact path='/' component={Forecast} />
<Route exact path='/map' component={Map} />
</Switch>
</Router>
</Provider>
)
export default Root
&#13;
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import promiseMiddleware from 'redux-promise-middleware'
import reducers from './reducers'
const store = createStore(reducers, applyMiddleware(
thunkMiddleware,
promiseMiddleware()
))
export default store
&#13;
答案 0 :(得分:1)
您需要对type
store
进行十分转换
例如:
const Root = ({ store } : {store : StoreType}) => {}