v0.20.230 - 22 / 5.9

Component

Component turns any value into a callable factory, useful for creating dynamic or untracked components. You can preset props at factory time; calling the factory with more props shallow-merges them over the presets (later wins, key-by-key).

# Component

nametypedescription
componentfn | Element | tagName | object with toStringwhat to turn into a factory. Strings become intrinsic elements ('div'); functions become user components; Elements are wrapped as-is; an object with a toString is coerced via that method (handy for third-party wrappers).
[props]objectpreset props. Omitted entirely when you only want the factory. When the factory is later called with overrides, the two are shallow-merged as { ...preset, ...override }.

# Component as a Factory

Component with default props

# Component With Props Override

Component with default props that change

# Component With Empty Props

props argument may be omitted