I have a question. Can I put data from getStaticProps to redux? I think it is the only way to deal with data in DB and on the client-side, because, for example when I delete data on the page it deletes in database but not on website
const Home: NextPage = (
props: InferGetStaticPropsType<typeof getStaticProps>
) => {
return <MainPage assets={props.assets} />;
};
export const getStaticProps: GetStaticProps = async (context) => {
const assetsId = await getDataFromMongo();
const promises = assetsId.map(async (id: string) => {
const response = await fetch(`https://rest.coinapi.io/v1/assets/${id}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-CoinAPI-Key": "key",
},
});
return await response.json();
});
return {
props: {
assets: (await Promise.all(promises)).flat(),
},
revalidate: 10,
};
};