reroute
This commit is contained in:
19
src/components/category/withCategoryRoute.jsx
Normal file
19
src/components/category/withCategoryRoute.jsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
||||
|
||||
export default function withCategoryRoute(Wrapped) {
|
||||
function CategoryRouteWrapper(props) {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { '*': categorySlugPath = '' } = useParams();
|
||||
|
||||
return (
|
||||
<Wrapped
|
||||
{...props}
|
||||
navigate={navigate}
|
||||
location={location}
|
||||
categorySlugPath={categorySlugPath}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return CategoryRouteWrapper;
|
||||
}
|
||||
Reference in New Issue
Block a user