node.js - Dynamic tag name in jsx and React -


i try write react component. html heading tags(h1,h2,h3,etc...), heading priority dynamically changing based on priority have defined in props.

here try do.

<h{this.props.priority}>hello</h{this.props.priority}>

expected output:

<h1>hello</h1>

this not working. there possible method this?

no way in-place, put in variable (with first letter capitalised):

const customtag = `h${this.props.priority}`;  <customtag>hello</customtag > 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -