Next.js Discord

Discord Forum

React. Add item to display list. Cant highlight it after adding it because havent yet been rendered

Unanswered
Virginia's Warbler posted this in #help-forum
Open in Discord
Virginia's WarblerOP
Im using state, which is an array.
When I add item to array, it re-renders.
But then, after I setState on that array state variable, I want to grab the newly added item in the display list document.getElementById and scroll down to it.
Currently it cant be found, Im guessing it havent yet been rendered.
How can I deal with this problem?

1 Reply

@Virginia's Warbler so you want something like auto-scroll to the bottom when a new reply arrives? like in the chat?