Automatically page scrolls to top when switching between tabs

Viewed 293
<div className="mainpanel">
  
</div>

Requirement:- While Switching tab in the left panel, Right Panel scroll back to the Top of the Page

1 Answers

Set a ref for the rightPanel.

You can try adding a handleTabChange callback to each tab using onClick. Inside the handleTabChange callback, using the ref.currentElement set the scrollTop property to 0.

Related