I want to show a different icon when a particular nav link is active.
I made a new component
import React, { useState } from "react";
import { NavLink } from "react-router-dom";
const CustomNavLink = ({ to, activeIcon, inActiveIcon }) => {
const [isActive, setIsActive] = useState(false);
const changeActive = ({ isActive }) => setIsActive(isActive);
return (
<NavLink to={to} className={changeActive}>
{isActive ? activeIcon : inActiveIcon}
</NavLink>
);
};
export default CustomNavLink;
But When I am using this code it is giving me this error.
How to solve this error?