I've got a list of objects that I sort and loop out to create React components with some inputs, when the onChange is fired i dispatch and update my redux state. The list of objects is then updated via a selector and the list is sorted and rerendered, which causes the scroll to go to the top. If I don't sort the list then there's no issue, but I need to sort it according to some requirements.
How do i prevent the scroll from jumping to the top?
return (
<Root>
<div>
{sortQuestions(administrativeQuestions).map((administrativeQuestion) => (
<QuestionItem key={administrativeQuestion.id} question={administrativeQuestion} />
))}
</div>
</Root>
)