Next.js Discord

Discord Forum

Button text (based on client data) without flickering

Unanswered
Tan posted this in #help-forum
Open in Discord
TanOP
I have a button whose text value should be loaded from local storage. I could use useEffect to update the text value of the button, but this approach leads to flickering. The button will first be rendered with empty string (the non-interactive html), and then be updated to the right value from local storage.

Is there an approach in nextjs so that the non-interactive html can load the value from the storage?
Local storage is not mandatory, we are open to approaches like setting values in the window object.

Any hits would be appreciated.

0 Replies