lost9123193 lost9123193 - 1 year ago 176
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} "}

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download