lost9123193 lost9123193 - 5 months ago 67
React JSX Question

JSX with Html Tag in React

Is there a way to incorporate react and an href tag?

The id:


The html tags:


Is there a way I can add the state Id to the html tag to get something like this?

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


You're almost correct, just misplaced a few quotes. You can do:

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

This will use the string #demo and concatenate it to this.state.id.