-
Notifications
You must be signed in to change notification settings - Fork 6
reactive()
Okku edited this page May 31, 2021
·
3 revisions
The reactive
method takes values of any type and converts them into reactive ones:
- If the value is an array, it gets converted into a
ReactiveArray
. - If the value is a Promise, it gets converted into a
ReactivePrimitive
that updates once the Promise resolves. Takes an optionalfallback
property in the optional options object as the second argument. - If the value is a non-function object, it gets passed to
reactiveObject()
. - Otherwise the value gets converted to a
ReactivePrimitive
.
The second argument is an optional options object:
-
options.fallback?
A fallback value to be displayed when the initial value is a pendingPromise
. -
options.parent?
Another reactive object to whom any reactive items created should report to when updating, so updates can correctly propagate to the highest level. You will most likely not need to ever set this option manually unless you're making custom extensioins.
- Reactivity
-
Templating
- Props vs. attributes (
prop:
) - Adding event listeners (
on:
) - Getting a reference to an element (
Ref
) - Using state in templates
- Animating elements (
destiny:mount
,destiny:unmount
) [to be written]
- Props vs. attributes (
-
Components
- Usage in templates
- Managing state [to be written]
- Styling components
- Passing props [to be written]
register()