I have a doubt.. can I use a useEffect inside getStaticProps?
I'm trying to run a function inside getStaticProps... it works.. but I don't know if it is the recommended thing to do.
useEffect(() => {
remarkBody()
}, [body, blogPostCollection])
If not ... what is the best way to run it?
useEffect
is used to execute code when component is mounted on client side, and when specific variables change.getStaticProps
is run only once on server side and at build time. You can put your code in the body of the function directly.And anyway if you do it you will have this error: