I'm getting this error in a react-redux-saga project:
Syntax error: yield is a reserved word (66:16)
function* broken(action) {
props.forEach(prop => {
const res = yield put(blah)
// do stuff yada yada in here
})
}
Turns out the internal function needs to be a generator too - but that then causes, erm, problems. So best to use a standard loop with no callbacks. Something like:
function* working(action) {
for (const prop of props) {
const res = yield put(blah)
// do stuff yada yada in here
}
}