Total Complexity | 0 |
Complexity/F | 0 |
Lines of Code | 24 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 87.5% |
Changes | 0 |
1 | import { useEffect } from 'react'; |
||
2 | import PropTypes from 'prop-types'; |
||
3 | |||
4 | 1 | const propTypes = { |
|
5 | location: PropTypes.object, |
||
6 | children: PropTypes.node, |
||
7 | }; |
||
8 | |||
9 | 1 | const ScrollToTop = () => { |
|
10 | 1 | const ScrollToTopComp = ({ location, children }) => { |
|
11 | 1 | useEffect(() => { |
|
12 | scrollTo(0, 0); |
||
13 | }, [ location ]); |
||
14 | |||
15 | 1 | return children; |
|
16 | }; |
||
17 | |||
18 | 1 | ScrollToTopComp.propTypes = propTypes; |
|
19 | |||
20 | 1 | return ScrollToTopComp; |
|
21 | }; |
||
22 | |||
23 | export default ScrollToTop; |
||
24 |