Reputation: 2132
I have the following React code:
const ResultItem = ({ category, name }) =>
<div className="projects animated fadeInUp">
<a href ={"/projects " + {name}}>
<h1 style ={project_box_h1}> {name} </h1></a>
<div className={`category--${category}`} />
</div>;
In h1
variable {name}
is working correctly and returns "Name"
.
But, in a href
variable {name}
returns something like this:
http://localhost:1234/projects%20[object%20Object]
How can I fix it?
Upvotes: 0
Views: 35
Reputation: 2170
<a href ={"/projects " + name}>
or
<a href ={`/projects ${name}`}>
Upvotes: 1