Reputation: 1540
I am trying to call a combined selector from redux-saga by passing video id to selector
import { createSelector } from 'reselect';
const selectVideoStore = state => state.video;
export const selectVideos = createSelector(
[selectVideoStore],
video => video.videos
);
export const selectVideosForPreview = ytid =>
createSelector(
[selectVideos],
videos => (videos ? videos[ytid] : null)
);
const selectedVideo = yield select(selectVideosForPreview, ytid);
console.log({ selectedVideo });
this returns a function in selectedVideo
Upvotes: 1
Views: 460
Reputation: 1241
Your selectVideosForPreview
is not a selector, but a selector factory. So you need to create a selector before passing it into yield select()
:
const selectedVideo = yield select(selectVideosForPreview(ytid));
Upvotes: 2