I am currently developing an app using React with Redux, Saga, and Typescript.
The structure of the app is such that each primary top-level container component has a corresponding file in a Store directory where its action creators, reducers, and sagas are defined.
At the start of the app, all reducers are combined from the Store files, and the Sagas are combined into a central rootSaga function.
Everything was working fine until I attempted to use a selector to load some state properties into one of my Sagas. Despite not receiving any errors, my selector function is failing to return the state values.
When I try to use the getState() function in my Store file, I encounter a Typescript error stating 'Cannot find the name getState'.
It seems like there might be an issue with either including the correct library in my Store file or calling the state function with the right namespace, but I'm struggling to identify the problem.
Previously, I switched from Thunk middleware to using Saga. With Thunk wired into the app, I was able to successfully use getState in the Store file.
This is the Store file containing my action creators, reducers, and sagas.
My selector function is also included in the file (export const getVersionQueueFilters):
import { fetch, addTask } from 'domain-task';
import { Action, Reducer, ActionCreator } from 'redux';
import { takeLatest, takeEvery } from "redux-saga"
import { call, put, take, race, select } from "redux-saga/effects"
import * as moment from 'moment';
// Rest of the content remains the same...
The selector is utilized within the saga function "versionPoller()".
In essence, I am polling my API for updated data, requiring the passing of at least a default set of filter values. My intention is to utilize the filter values currently stored in the state for this purpose.
I have also attempted defining my selector function as:
export const getVersionQueueFilters = getState().ASVersionQueueState.versionQueueFilter;
However, this approach results in the error 'cannot find the name getState'.
Could you provide any insight into what I might be doing incorrectly?