Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React escaping vars inside an element

  {emails.map(item => (
      <tr><td>{item.date}</td><td>{item.from}</td><td>{item.to}</td><td>{item.subject}</td><td><a href="{item.s3_key}">view</a></td></tr>
    ))}

I am trying to set the href="{item.s3_key}" but it just returns the string literal. I can't see docs for this, can someone help?

like image 513
David Avatar asked Dec 17 '25 08:12

David


1 Answers

With quotes around the item.s3_key, it will be parsed as a string. Remove it to get the desired result.

href={item.s3_key}

like image 59
kind user Avatar answered Dec 19 '25 22:12

kind user



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!