Next.js Discord

Discord Forum

Get value of use state before render

Unanswered
Standard Chinchilla posted this in #help-forum
Open in Discord
Standard ChinchillaOP
is there a way to get the value of a stored state and use it before each page render? For me, it starts at 0 and then moves to the actual value after a moment:

  <motion.div
              layout
              transition={{ duration: 0.5 }}
              className="absolute bg-white w-64 h-2"
              style={{ left: `${left}px` }}
            />


I want it to instantly snap to the stored state value of "left"

1 Reply

Standard ChinchillaOP
I tried using context as well but I think I may be misunderstanding the order of things