import react createelement code example

Example 1: react.createElement

//Below I use the React.createElement() function to create a virtual DOM
//representation of a <li> element node containing a text node of one (a.k.a.,
//React text) and an id of li1.

var reactNodeLi = React.createElement('li', {id:'li1'}, 'one');

Example 2: 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>
  )
}