Is there a way to incorporate React’s curly brace notation and an href tag? Say we have the following value in the state:

{this.state.id}

and the following HTML attributes on a tag:

href="#demo1"
id="demo1"

Is there a way I can add the id state to the HTML attribute to get something like this:

href={"#demo + {this.state.id}"}

Which will yield:

#demo1

5 Answers
5

Leave a Reply

Your email address will not be published. Required fields are marked *