This is my code,
import "./styles.css";
import React from "react";
export default function App() {
const categories = [
{ name: "aaa", slug: "aaa" },
{ name: "baa", slug: "baa" }
];
const handleClick = (value) => {
console.log(value);
};
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<div>
<ul>
{categories.map((category) => (
<li className="cat_item" key={category.slug}>
<a
value="value"
onClick={(e) => handleClick(e.currentTarget.value)}
className="dropdown-item"
>
{category.name}
<span className="text-gray-25 font-size-12 font-weight-normal"></span>
</a>
</li>
))}
</ul>
</div>
</div>
);
}
But whn I click it appear as undefined instead of value in log. Here is a fiddle of issue
e.target.valueinstead