Summary
I'm using redux-saga-firebase and to listen for changes in Firestore and I want to pass in a variable from my redux store to my watcher function. I'm new to redux so I'm having some trouble. I think I should use a selector but I'm not 100% how to do so. I'm also open any other solutions!
Code
Watcher Saga
export function* watchSquadChannel() {
const userData = "345fgr45gdgdfdfe";
try {
yield put(syncSquadLoading());
const channel = RSF.firestore.channel(
`data/${userData}`,
"document"
);
while (true) {
const response = yield take(channel);
const {
_data: {
event: { data }
}
} = response;
yield put(syncSquadSuccess(data));
}
} catch (error) {
yield put(syncSquadFailure(error));
}
}
Data I want to pass in
I want to pass in userData so I can listen only for changes in the document named with that user's ID. userData is stored in my redux store under user object. data structure = state.user.userData
Thanks in advance for your help!