Documentation

website.macros

<>

macro

(<> component & args)

Return a component vector. Module references use the lazy loader only until their code is available; direct components never acquire a loader wrapper. Use (<> spec), (<> :blog/post spec), or (<> {:module :blog :view :post} spec).

<>

macro

(<> component & args)

Return a component vector. Module references use the lazy loader only until their code is available; direct components never acquire a loader wrapper. Use (<> spec), (<> :blog/post spec), or (<> {:module :blog :view :post} spec).

defc

macro

(defc name & decls)

Define a lean Reagent 2 function component with optional composed features.

Plain definitions delegate directly to r/defc. An optional spec declaration map after the optional docstring declares :features and :depends. Features include :error-boundary, :props, :lifecycle, :links, and registered extensions. Merge-only features run inline with hooks; only error boundaries need classes. :appear and :seen merge onto a native root; :presence retains keyed :exit children until their exit animations finish.

:depends is a vector of data-source descriptors, or a function of component arguments returning that vector. Dependencies start before mount and can be explicitly prefetched with component/preload!. :data enables dependencies supplied through the first argument at runtime. Spec arguments are inferred from spec/opts/options bindings or destructured feature keys; domain-data arguments need no opt-out annotation.

For spec-capable components, the first Hiccup argument may be a spec map or an ordered feature vector: [

:appear false title] is equivalent to [
{:features :appear false} title]. Keyword entries enable features; id config entries refine, replace, or disable them. An empty vector inherits declaration defaults. The runtime expands this shorthand to {:features …} before argument/spec validation, configuration functions and the component body. Use a map with an explicit :features key when also passing :props, :container, :depends, or domain fields. Inferred non-spec components and explicit :spec false declarations keep vectors as ordinary domain data.

Optional :let bindings initializes per-instance state. Existing form-2 bodies, destructured/variadic arguments, docstrings and metadata are supported. Use components in Hiccup, not as ordinary functions (Reagent 2 convention).

(defc {:features :props :error-boundary} [{:keys label :as spec}] :let *count (r/atom 0) :button {:on-click #(swap! *count inc)} label @*count)

defc

macro

(defc name & decls)

Define a lean Reagent 2 function component with optional composed features.

Plain definitions delegate directly to r/defc. An optional spec declaration map after the optional docstring declares :features and :depends. Features include :error-boundary, :props, :lifecycle, :links, and registered extensions. Merge-only features run inline with hooks; only error boundaries need classes. :appear and :seen merge onto a native root; :presence retains keyed :exit children until their exit animations finish.

:depends is a vector of data-source descriptors, or a function of component arguments returning that vector. Dependencies start before mount and can be explicitly prefetched with component/preload!. :data enables dependencies supplied through the first argument at runtime. Spec arguments are inferred from spec/opts/options bindings or destructured feature keys; domain-data arguments need no opt-out annotation.

For spec-capable components, the first Hiccup argument may be a spec map or an ordered feature vector: [

:appear false title] is equivalent to [
{:features :appear false} title]. Keyword entries enable features; id config entries refine, replace, or disable them. An empty vector inherits declaration defaults. The runtime expands this shorthand to {:features …} before argument/spec validation, configuration functions and the component body. Use a map with an explicit :features key when also passing :props, :container, :depends, or domain fields. Inferred non-spec components and explicit :spec false declarations keep vectors as ordinary domain data.

Optional :let bindings initializes per-instance state. Existing form-2 bodies, destructured/variadic arguments, docstrings and metadata are supported. Use components in Hiccup, not as ordinary functions (Reagent 2 convention).

(defc {:features :props :error-boundary} [{:keys label :as spec}] :let *count (r/atom 0) :button {:on-click #(swap! *count inc)} label @*count)

defcomp-

macro

(defcomp- name & decls)

Define a reagent component with a docstring and metadata, standardized arg parsing, but no extra functionality like error boundaries and such. Usage: (defcomp- “This is a light component” spec-or-form (into :div (:props spec) form)) Meaning (TODO) a single arg gets destructured as spec containing form, or component not taking a form.

defcomp-

macro

(defcomp- name & decls)

Define a reagent component with a docstring and metadata, standardized arg parsing, but no extra functionality like error boundaries and such. Usage: (defcomp- “This is a light component” spec-or-form (into :div (:props spec) form)) Meaning (TODO) a single arg gets destructured as spec containing form, or component not taking a form.

defpage

macro

(defpage name & decls)

A defc page declaration with a mandatory error boundary. Other features and dependencies compose as usual. An optional layout container encloses the boundary; :container false opts out for the site shell.

defpage

macro

(defpage name & decls)

A defc page declaration with a mandatory error boundary. Other features and dependencies compose as usual. An optional layout container encloses the boundary; :container false opts out for the site shell.

for

macro

(for [id xs & ls] <c>)

Like clojure.core/for, but non-lazy, and injects :key metadata into each item.

for

macro

(for [id xs & ls] <c>)

Like clojure.core/for, but non-lazy, and injects :key metadata into each item.

hafn

macro

(hafn & body)

Use in event-handlers instead of (fn e/_), returns nil so react doesnt get a false and ignore us

hafn

macro

(hafn & body)

Use in event-handlers instead of (fn e/_), returns nil so react doesnt get a false and ignore us

make-modules

macro

(make-modules base ks)

Use keywords to generate Shadow lazy loadables. ks must be a literal seq of keywords at the call site.

make-modules

macro

(make-modules base ks)

Use keywords to generate Shadow lazy loadables. ks must be a literal seq of keywords at the call site.

ors

macro

(ors)(ors x)(ors x & next)

(or), but treats empty string as nil. not working

ors

macro

(ors)(ors x)(ors x & next)

(or), but treats empty string as nil. not working

register-render-functions!

macro

(register-render-functions!)

Register namespace-local public legacy <…> functions without changing their identity or signature.

register-render-functions!

macro

(register-render-functions!)

Register namespace-local public legacy <…> functions without changing their identity or signature.

tap>

macro

(tap> x)

Tap a value and return it for use in threading expressions.

tap>

macro

(tap> x)

Tap a value and return it for use in threading expressions.