Skip to main content

createElement

Callable

  • createElement<K>(type: K, props?: DomIntrinsicElements[K], children?: Children): Template
  • createElement<T>(...args: [type: new () => T, ...({} extends JsxProps<T> ? [props?: JsxProps<T>] : [props: JsxProps<T>])[], children?: Children]): Template
  • createElement<P>(...args: [type: FunctionalComponent<P>, ...({} extends P ? [props?: P] : [props: P])[], ...(P extends { children?: unknown } ? undefined extends P<P>[children] ? [children?: P<P>[children]] : [children: P<P>[children]] : [])[]]): Template

  • Creates a template based on the given component type.

    @example
    render() {
    return createElement("div", { id: "app" }, [
    createElement("h1", {}, "Hello, World!"),
    ]);
    }

    Type parameters

    • K: string