Solid Cheat Sheet - APIs

Reactive state

createSignal - simple state

createMemo - derived state

createResource - async state

createStore - state objects

produce - local store mutation

reconcile - store diffing

unwrap - returns data without the store

createMutable - store with setters

Effects

createEffect - run side effect

onMount - run side effect on mount

onCleanup - run side effects on unmount

onError - run side effect on error

createDeferred - defer signal when idle

createComputed - effect immediately before render

createRenderEffect - effect during rendering

createReaction - effect with external tracking

createSelector - signal only when selected

Reactive Tracking

untrack - reads without tracking updates

batch - synchronous updates

on - explicitly tracks updates

useTransition - batch asynchronous updates

startTransition - batch asynchronous updates

observable - signal to rxjs observable

from - rxjs observable to signal

Reactive Scope

createRoot - creates tracking context

getOwner - get the current tracking context

runWithOwner - runs in tracking context

Reactive Data

mergeProps - reactive object merge

splitProps - reactive object splitting

mapArray - reactively maps fixed length array

indexArray - reactively maps varying length array

Component APIs

createContext - state bound to component tree

useContext - use bound state

children - reactively unwrap children

lazy - unwrap promise containing component

createUniqueId - unique ID for components

Rendering

render - applies component to mount point

hydrate - adds client-side logic to server-rendered html

renderToString - html string from component

renderToStringAsync - async renderToString

renderToStream - render to (node/web) stream

isServer - true if run in ssr mode

generateHydrationScript - hydrate SSR components on the server

<HydrationScript /> - hydrate SSR components on the client

<JSX prop={value}

ref - access DOM element

classList - class names from object

style - inline styles (string or object)

innerHTML - directly inject HTML

textContent - directly inject Text

on[event] - delegated dom events

on:[event] - direct dom events

oncapture:[event] - capturing dom events

use:[directive] - use custom directive

prop:[property] - direct dom property access

attr:[attribute] - direct dom attribute access

/*@once*/ - untrack for JSX properties

/>{props.children}</JSX>

JSX Control Flow

<Show> - conditionally show content

<Switch>/<Match> - multiple conditions

<For> - map array items by position

<Index> - map array items by value

<Dynamic> - variable component

<Portal> - render elsewhere

<ErrorBoundary> - catch errors in components

<Suspense> - fallback for async state

<SuspenseList> - organize async fallback