Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

create react element with string

mport React from 'react'

const MyComponent = 'div'

function App() {
  return (
    <div>
      <h1>Hello</h1>
      <hr />
      <MyComponent>
        <h3>I am inside a {'<div />'} element</h3>
      </MyComponent>
    </div>
  )
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #react #element #string
ADD COMMENT
Topic
Name
1+5 =