I am facing a problem where I am fetching different api's based on params?.id. I need to compare the prev and current useParams for an api call using rtkQuery. But it is not recalling my api on useparams change.
const {
data: pipelineData,
isLoading: pipelineDataLoading,
error: pipelineDataError,
isSuccess: pipelineDataSuccess,
} = pipeline.list().usePipelinedetailQuery(
{ params: { id: params.pipelineId }, extendedPath: apiUrls.getPipeline() },
{
skip: !params?.pipelineId,
},
);
I want to use something like skip: if prev.params.id !== prams.id. there are two ways to do it. =>By setting a state to store prev value of useParams. =>by using refecthh provided by rtk query.
Is there any other authhentic way to do it.
Any help would be appreciated.