redux-saga-beginner-tutorial示例代码与原文不同
LiuYashion opened this issue · 0 comments
LiuYashion commented
目前文档中的代码:
// ...
import { createStore, applyMiddleware } from 'redux'
import createSagaMiddleware from 'redux-saga'
//...
import { helloSaga } from './sagas'
const store = createStore(
reducer,
applyMiddleware(createSagaMiddleware(helloSaga))
)
// rest unchanged
应该更新为:
// ...
import { createStore, applyMiddleware } from 'redux'
import createSagaMiddleware from 'redux-saga'
// ...
import { helloSaga } from './sagas'
const sagaMiddleware = createSagaMiddleware()
const store = createStore(
reducer,
applyMiddleware(sagaMiddleware)
)
sagaMiddleware.run(helloSaga)
const action = type => store.dispatch({type})
// rest unchanged