APIs

createElement

Constructs a React element description without JSX. It does not mount a component or create a DOM node. Pass dynamic child arrays as an array and give their elements stable keys.

Formal Syntax & Structure

react syntaxreact
createElement(type, props, ...children)

Parameters & Attributes

NameTypeDescription
typestring | componentHost element name or valid component type.
propsobject | nullProperties for the element; null means none.
...childrenReact nodesOptional child values.

Return Value

React element

A description that a renderer can consume.

Working Example

Example Snippetreact
import { createElement } from 'react';export default function App() {  return createElement('p', {className: 'notice'}, 'Tools available');}
React Reference