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>;
Share:
48,069
Peter Wateber
Author by

Peter Wateber

Updated on August 16, 2020

Comments

  • Peter Wateber
    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>
    

    enter image description here

    BASE_URL as enter image description here

    When I run this code, I get this output in the browser: enter image description here

    What's the correct way of doing this?