Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
63
rated 0 times [  67] [ 4]  / answers: 1 / hits: 59146  / 9 Years ago, thu, january 14, 2016, 12:00:00
// This Javascript <a> tag generates correctly
React.createElement('a', {href:mailto:+this.props.email}, this.props.email)


However, I'm struggling to recreate it in JSX



<a href=mailto: {this.props.email}>{this.props.email}</a>

// => <a href=mailto: {this.props.email}></a>


The href tag thinks the {this.props.email} is a string instead of dynamically inputting the value of {this.props.email}. Any ideas on where I went amiss?


More From » reactjs

 Answers
28

It is returning a string because you are assigning it to a string.



You'll want to set it to a dynamic property, that includes a the string at the beginning of it



<a href={mailto: + this.props.email}>email</a>


[#63741] Monday, January 11, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leog

Total Points: 225
Total Questions: 113
Total Answers: 118

Location: Oman
Member since Wed, Apr 12, 2023
1 Year ago
;