Check out example codes for "html scroll div to top". It will help you in understanding the concepts better.

Code Example 1

var myDiv = document.getElementById('containerDiv');
myDiv.innerHTML = variableLongText;
myDiv.scrollTop = 0;

Learn ReactJs, React Native from akashmittal.com