-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApp.jsx
27 lines (23 loc) · 868 Bytes
/
App.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import PropTypes from "prop-types";
import * as React from "react";
import { useLocation } from "react-router-dom";
import DefaultLayout from "./components/Layouts/DefaultLayout";
/**
* DefaultLayout component
* @component
* @param {Object} props - Properties passed to component
* @param {string} [props.breadCrumbName] - The name of the current page to be displayed in the breadcrumb
* @param {React.ReactNode} props.children - The child nodes to be rendered within the layout
*/
function App({ children, breadCrumbName = "" }) {
const { pathname } = useLocation();
React.useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);
return <DefaultLayout breadCrumbName={breadCrumbName}>{children}</DefaultLayout>;
}
App.propTypes = {
children: PropTypes.node.isRequired,
breadCrumbName: PropTypes.string
};
export default App;