Liking cljdoc? Tell your friends :D

views.reagent.client.component


defvccljmacro

(defvc component-name doc-string? attr-map? [params*] body)

Defines a Reagent component that works the same as any other defined using defn with the addition that view-cursor can be used in the render function of these components to access data from subscribed views.

To subscribe to a view, simply call view-cursor with the signature of the view you want to subscribe to and read data from. view-cursor and components defined with defvc will automatically manage subscribing and unsubscribing to views as the view signatures passed to any view-cursor calls change across the lifetime of this component.

Defines a Reagent component that works the same as any other defined
using defn with the addition that view-cursor can be used in the
render function of these components to access data from subscribed
views.

To subscribe to a view, simply call view-cursor with the signature of
the view you want to subscribe to and read data from. view-cursor and
components defined with defvc will automatically manage subscribing
and unsubscribing to views as the view signatures passed to any
view-cursor calls change across the lifetime of this component.
raw docstring

loading?cljs

(loading? view-cursor)

Returns true if the given view-cursor is still waiting for initial data to be received from the server. Once that first set of data is received, this function will always return false and cannot be used to e.g. check if an updated set of data is waiting to be received.

Returns true if the given view-cursor is still waiting for initial data
to be received from the server. Once that first set of data is received,
this function will always return false and cannot be used to e.g. check
if an updated set of data is waiting to be received.
raw docstring

prepare-for-render!cljs

(prepare-for-render! this)

Prepares the used-view/last-used-view sigs state for the upcoming component render. NOTE: this function is only intended to be used internally by defvc.

Prepares the used-view/last-used-view sigs state for the upcoming
component render.
NOTE: this function is only intended to be used internally by defvc.
raw docstring

unsubscribe-all!cljs

(unsubscribe-all! this)

Unsubscribes a component from all it's current view subscriptions. NOTE: this function is only intended to be used internally by defvc.

Unsubscribes a component from all it's current view subscriptions.
NOTE: this function is only intended to be used internally by defvc.
raw docstring

update-subscriptions!cljs

(update-subscriptions! this)

Updates view subscriptions by checking what view-sigs were passed to any view-cursor calls during the most recent render and comparing against the view-sigs that were used during the previous render. Automatically subscribes to new view-sigs and unsubscribes from old ones only as is needed. NOTE: this function is only intended to be used internally by defvc.

Updates view subscriptions by checking what view-sigs were passed to
any view-cursor calls during the most recent render and comparing
against the view-sigs that were used during the previous render.
Automatically subscribes to new view-sigs and unsubscribes from old
ones only as is needed.
NOTE: this function is only intended to be used internally by defvc.
raw docstring

view-cursorcljs

(view-cursor view-id & parameters)

Returns a Reagent cursor that can be used to access the data for a view. If the view-sig is not currently subscribed to, the subscription will be added automatically by the containing component, but this function will return a cursor pointing to nil data until the server sends the initial data for the new subscription (at which point a re-render is triggered).

This function can only be used with the render function of a component defined using defvc.

NOTE: The data returned by this function is intended to be used in a read-only manner. Using this cursor to change the data will not propagate the changes to the server.

Returns a Reagent cursor that can be used to access the data for a view.
If the view-sig is not currently subscribed to, the subscription will be
added automatically by the containing component, but this function will
return a cursor pointing to nil data until the server sends the initial
data for the new subscription (at which point a re-render is triggered).

This function can only be used with the render function of a component
defined using defvc.

NOTE: The data returned by this function is intended to be used in a
      read-only manner. Using this cursor to change the data will *not*
      propagate the changes to the server.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close