Module

Solid.Component

Package
purescript-purs-solid
Repository
arazorda/purs-solid

A component's body runs once per use, in Setup. Props are a plain record: pass Accessors for values that change.

#Component Source

type Component props = ComponentRep props

#component Source

component :: forall props. (Record props -> Setup JSX) -> Component (Record props)

#element Source

element :: forall props. Component (Record props) -> Record props -> JSX

#children Source

children :: Setup JSX -> Setup (Accessor JSX)

Resolves children once, so a component can inspect or place them without re-creating them.

#childrenArray Source

childrenArray :: Setup JSX -> Setup (Accessor (Array JSX))

Like children, as the list of resolved children (a fragment is flattened).

#createUniqueId Source

createUniqueId :: Setup String

A unique id, stable between server render and hydration.

#lazy Source

lazy :: forall @name props. LazyName name => Component (Record props)

Loaded on first use, suspending the nearest loading boundary. Named by the component's qualified name; purs-solid/vite bundles its module as a separate chunk:

settings :: Component { user :: User }
settings = lazy @"App.Settings.settings"

#clientOnly Source

clientOnly :: forall @name props. LazyName name => Component { fallback :: JSX | props }

Like lazy, but never runs on the server: the server, and hydration, render fallback; the component replaces it once loaded and hydrated. For browser-only code (window, DOM measurement). Loading starts on first render.

#preload Source

preload :: forall props. Component props -> Effect Unit

Starts loading a lazy component early (e.g. on hover). Does nothing for other components.

Re-exports from Solid.Internal.View

#LazyModule Source

data LazyModule

A module namespace from a dynamic import().