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");
}

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/golayrva/public_html/lib/Varien/Filter/Template/Tokenizer/Abstract.php on line 89
Most Helpful This Week