Attribute Macro perseus::template_rx
source · #[template_rx]
Expand description
The new version of #[template]
designed for reactive state. This can
interface automatically with global state, and will automatically provide
Sycamore #[component]
annotations. To use this, you don’t need to provide
anything other than an optional custom type parameter letter (by default,
G
will be used). Unlike with the original macro, this will automatically
handle component names internally.
The first argument your template function can take is state generated for it
(e.g. by the build state strategy), but the reactive version (created with
#[make_rx]
usually). From this, Perseus can infer the other required types
and automatically make your state reactive for you.
The second argument your template function can take is a global state
generated with the GlobalStateCreator
. You should also provide the
reactive type here, and Perseus will do all the rest in the background.