Here is the problem, first this project is generated using vite. I have the error that says Warning: React does not recognize the
activeStyle prop on a DOM element
. That is a first few lines from the error. I issue comes up when I add the activeStyle prop in the NavLink component from react-router-dom
which should be its built-in prop however react does not recognize that as a valid prop, how could that be ? Do you have any idea whats happening ?
here is the component in the project that contains the eror:
Header.jsx
import { NavLink } from "react-router-dom";
const Header = () => {
return (
<div className="header">
<NavLink to="/" activeStyle={{ fontWeight: "bold", color: "red" }}>
Home
</NavLink>
<NavLink to="/about" activeStyle={{ fontWeight: "bold", color: "red" }}>
About
</NavLink>
</div>
);
};
export default Header;
vite.config.js
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import sass from "sass";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
css: {
preprocessorOptions: {
sass: {
implementation: sass,
},
},
},
});