Next.js next start Not Updating Component State
Unanswered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Hi everyone,
I'm encountering an issue with my Next.js web app. When I run next start, the component state doesn't update visually as expected. However, next dev and running the app via Node.js and the ./bin/next file work perfectly fine.
Here is my component code:
In next start, the variable state does not visually update or re-render to the new value, even though the value is saved on the server.
I'd appreciate any insights or suggestions to resolve this issue.
Thank you for your time!
I'm encountering an issue with my Next.js web app. When I run next start, the component state doesn't update visually as expected. However, next dev and running the app via Node.js and the ./bin/next file work perfectly fine.
Here is my component code:
const data = await getData();
const setData = (someData) => {
// Save data to server, via server component
// and
setVariable(e);
};
const [variable, setVariable] = useState(0);
return (
<div>
<button onChange={setData}>{variable}</button>
</div>
);In next start, the variable state does not visually update or re-render to the new value, even though the value is saved on the server.
I'd appreciate any insights or suggestions to resolve this issue.
Thank you for your time!
1 Reply
Transvaal lionOP
Sorry for my 'noob-ness'. Everything I need is covered in the document (https://nextjs.org/docs/app/building-your-application/data-fetching). Thank you for your time!