Next.js Discord

Discord Forum

On a static page, do I need to wrap date checking in a useEffect?

Unanswered
Rampur Greyhound posted this in #help-forum
Open in Discord
Rampur GreyhoundOP
I have some content on a static page (getStaticProps etc) I would like to style dynamically based on whether it is in the past or not. Do I need to wrap the function in a useEffect to avoid have the date stuck at build time? At the moment I have a useDateNow state hook and update it in a useEffect once on load - but I was wondering if this is overkill? Thanks very much

0 Replies