nav links

This commit is contained in:
VividTruthKeeper 2023-02-09 15:52:04 +05:00
parent df9db820c9
commit fe8933e108
1 changed files with 8 additions and 1 deletions

View File

@ -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">