mount
mount hydrates a client entry and includes island hydration handling.
Import
import { mount } from "@solidjs/start/client";Type
function mount( fn: () => JSX.Element, el: MountableElement): (() => void) | undefined;Parameters
fn
- Type:
() => JSX.Element - Required: Yes
Function that returns the client app element.
el
- Type:
MountableElement - Required: Yes
Element used as the hydration root.
Return value
- Type:
(() => void) | undefined
Returns the value from hydrate for non-island builds. In island builds, it returns undefined.
Behavior
- In non-island builds,
hydrateis called withfnandel. - Island builds hydrate
solid-island[data-hk]elements and do not callhydrate(fn, el). - CSS links listed in
data-cssare loaded when a matchinglink[href]is not already present. - Islands with
data-when="idle"hydrate throughrequestIdleCallbackwhen it exists.
Examples
Basic usage
import { mount, StartClient } from "@solidjs/start/client";
mount(() => <StartClient />, document.getElementById("app")!);