render
ts
import type { JSX, MountableElement } from "solid-js/web";function render(code: () => JSX.Element, element: MountableElement): () => void;
ts
import type { JSX, MountableElement } from "solid-js/web";function render(code: () => JSX.Element, element: MountableElement): () => void;
This is the browser app entry point. Provide a top-level component function and an element to mount to. It is recommended this element be empty: while render
will just append children, the returned dispose function will remove all children.
ts
const dispose = render(App, document.getElementById("app"));// orconst dispose = render(() => <App />, document.getElementById("app"));
ts
const dispose = render(App, document.getElementById("app"));// orconst dispose = render(() => <App />, document.getElementById("app"));
It's important that the first argument is a function: do not pass JSX directly (as in render(<App/>, ...)
), because this will call App before render can set up a root to track signal dependencies within App.