As others have pointed out, you are wrapping your Routes component with a ScrollToTop component, but I recommend converting it to a React hook rather than editing it to render its implicit children property, especially considering that it actually Doesn't render anything, you want it to run as a side effect of navigation.