so Im trying to access the values from the store, after updating the redux state. but the values are empty even though the store gets updated synchronously.
const {
storeSimulationSelProd,
storeApiProductsData,
storeUpdatedInput,
storeUpdatedResponse
} = useSelector((state) => {
return state.resultsCard
}
const addNewPanel = async () => {
console.log(simulationSelProd)
console.log(apiProductsData)
console.log(updatedInput)
console.log(updatedResponse)
dispatch(updateResultsCard({simulationSelProd, apiProductsData, updatedInput, updatedResponse}))
const newPanel = (
<Panel header={"Simulation " + ((panels.length)+1)} key={(panels.length) + 1}>
<ResultsCard options={dropdownProducts} selectedProduct={storeSimulationSelProd} productsData={storeApiProductsData} inputData={storeUpdatedInput} response={storeUpdatedResponse} showSendToResultTab={true} showData={true}/>
</Panel>
);
const updatedPanels = [...panels, newPanel];
setPanels(updatedPanels)
dispatch(setSimulation({selectedProduct, updatedPanels}))
}
I want to pass these values as props, to another component, but it is getting updated late even though the store is getting updated when i am checking synchronously. any fix for this?