nav links
This commit is contained in:
parent
df9db820c9
commit
fe8933e108
|
|
@ -1,5 +1,5 @@
|
|||
// Modules
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { motion } from "framer-motion";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
|
@ -45,6 +45,13 @@ const SubNav = () => {
|
|||
api.get(data, setData);
|
||||
}, [language]);
|
||||
|
||||
const location = useLocation();
|
||||
useEffect(() => {
|
||||
if (!location.pathname.includes("category")) return;
|
||||
const category = location.pathname[location.pathname.length - 1];
|
||||
onClickLink(parseInt(category));
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<nav className="subnav">
|
||||
<div className="container">
|
||||
|
|
|
|||
Loading…
Reference in New Issue