reactjs - anchor tag link
48,069
Solution 1
In this case, you just need to lose the quotes:
<a href={BASE_URL}>
You can play with the JSX compiler at babeljs to get a slightly better idea of what JS it compiles into.
Solution 2
Also, instead of returning an object, you can use the key attribute
return <ul className="nav" key="list"> ... </ul>;
Author by
Peter Wateber
Updated on August 16, 2020Comments
-
Peter Wateber almost 4 years
I'm trying to figure out how to output these lines of codes into something like
<a href="http://">SOMETHING</a>
BASE_URL as
When I run this code, I get this output in the browser:
What's the correct way of doing this?