mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-15 11:06:18 +00:00
Migrated some common components and their dependencies to TS
This commit is contained in:
12
src/common/ScrollToTop.tsx
Normal file
12
src/common/ScrollToTop.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import React, { PropsWithChildren, useEffect } from 'react';
|
||||
import { RouteChildrenProps } from 'react-router';
|
||||
|
||||
const ScrollToTop = () => ({ location, children }: PropsWithChildren<RouteChildrenProps>) => {
|
||||
useEffect(() => {
|
||||
scrollTo(0, 0);
|
||||
}, [ location ]);
|
||||
|
||||
return <React.Fragment>{children}</React.Fragment>;
|
||||
};
|
||||
|
||||
export default ScrollToTop;
|
||||
Reference in New Issue
Block a user