How to use createElement in React JS?
The component function returns the result from the React.createElement method, React can use that HTML element to add content in Domain Object Model (DOM).
Example
import React, { Component } from 'react';
export default function App() {
return React.createElement("h1",
{ className: "bg-secondary text-white text-center p-2" },
"Hello World");
}
Most Helpful This Week
How to use arrow function in React stateless components?
How to create simple React Router to navigate multiple pages?
How to render raw HTML content in React JS?
How to use onChange and onClick event in React JS?
Using this keyword access component properties and methods
How to build and use a custom react component from scratch?