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
| Name | Type | Description |
|---|---|---|
| type | string | component | Host element name or valid component type. |
| props | object | null | Properties for the element; null means none. |
| ...children | React nodes | Optional 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');}