Redux #17025
Answered
by
leerob
daveOnactive
asked this question in
Help
Redux
#17025
-
I am trying to create a global state and I want to dispatch the action in the getStaticProps function, Please help |
Beta Was this translation helpful? Give feedback.
Answered by
leerob
Sep 12, 2020
Replies: 1 comment 2 replies
-
Here's a Redux example you can start with: https://github.com/vercel/next.js/tree/canary/examples/with-redux-toolkit You probably don't want to (and can't) dispatch an action from |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
daveOnactive
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a Redux example you can start with: https://github.com/vercel/next.js/tree/canary/examples/with-redux-toolkit
You probably don't want to (and can't) dispatch an action from
getStaticProps
, since it's run on the server (Node.js context). Instead, you're probably wanting to dispatch an action when the component first renders, yeah?