The functionality I'm trying to achieve is that when I click on a TreeItem that has children and expand it, a scroll accures so that the expanded item is shown on top. How can I implement that?
You can make some component in App.(j|t)sx and there make this function
useEffect(() => {
sctollOnTop();
});
and that will rescroll on every rout change... if you don't need to run it on scroll change just make some other function and reuse that on each open of item.