Crate sycamore_reactive[−][src]
Expand description
Reactive primitives for Sycamore.
To learn more, read the section on Reactivity in the Sycamore Book.
Macros
Utility macro for cloning all the arguments and expanding the expression.
Structs
A struct that can be debug-printed to view the scope hierarchy at the location it was created.
Owns the effects created in the current reactive scope.
The effects are dropped and the cleanup callbacks are called when the ReactiveScope
is
dropped.
A weak reference to a ReactiveScope
. This can be created by calling
ReactiveScope::downgrade
.
A readonly Signal
.
State that can be set.
Functions
Creates a ReactiveScope
with the specified parent scope. The parent scope does not
necessarily need to be the current scope.
Creates a new ReactiveScope
with a context and runs the supplied callback function.
Creates an effect on signals used inside the effect closure.
Creates a memoized value from some signals. Also know as “derived stores”.
An alternative to Signal::new
that uses a reducer to get the next value.
Creates a new reactive root / scope. Generally, you won’t need this method as it is called
automatically in render
.
Creates a new reactive root / scope. Generally, you won’t need this method as it is called
automatically in render
.
Creates a memoized value from some signals. Also know as “derived stores”.
Unlike create_memo
, this function will not notify dependents of a change if the output is
the same. That is why the output of the function must implement PartialEq
.
Creates a memoized value from some signals. Also know as “derived stores”.
Unlike create_memo
, this function will not notify dependents of a change if the output is
the same.
Returns a ReactiveScopeWeak
handle to the current reactive scope. If outside a scope,
returns a ReactiveScopeWeak
that points to nothing.
Returns a DebugScopeHierarchy
which can be printed using std::fmt::Debug
to debug the
scope hierarchy at the current level.
Gets the number of dependencies of the current reactive scope.
Function that maps a Vec
to another Vec
via a map function. The mapped Vec
is lazy
computed, meaning that it’s value will only be updated when requested. Modifications to the
input Vec
are diffed by index to prevent recomputing values that have not changed.
Function that maps a Vec
to another Vec
via a map function. The mapped Vec
is lazy
computed, meaning that it’s value will only be updated when requested. Modifications to the
input Vec
are diffed using keys to prevent recomputing values that have not changed.
Adds a callback function to the current reactive scope’s cleanup.
Get the value of a context in the current ReactiveScope
or None
if not found.
Run the passed closure inside an untracked dependency scope.
Get the value of a context in the current ReactiveScope
.