View Source Love.Component (love_ex v0.1.1)

🔥 Rekindle your love for components.

Link to this section Summary

Functions

Defines a state field.

Defines a component prop field.

Puts many computed values.

Puts a computed value into the component.

Puts many state changes into the component.

Defines a slot prop.

Defines a state field.

Link to this section Functions

Link to this macro

computed(key, quoted_opts \\ [])

View Source (macro)

Defines a state field.

The second arg is the initial value for this state field (defaults to nil if omitted).

Link to this macro

prop(key, quoted_opts \\ [])

View Source (macro)

Defines a component prop field.

options

Options

  • :default - optional; if specified, this prop is considered optional, and will be assigned the default value during mount. If nothing is passed, this prop is required. nil is a valid default value (i.e. it will be optional)
Link to this function

put_computed(socket, changes)

View Source

Puts many computed values.

Link to this function

put_computed(socket, key, value)

View Source

Puts a computed value into the component.

Link to this function

put_state(socket, changes)

View Source

Puts many state changes into the component.

This will also immediately reevaluate any necessary reactive fields, so call this as infrequently as possible (i.e. state changes should be batched).

Link to this macro

slot(key, quoted_opts \\ [])

View Source (macro)

Defines a slot prop.

Takes the same arguments as prop/2.

Link to this macro

state(key, quoted_opts \\ [])

View Source (macro)

Defines a state field.

The second arg is the initial value for this state field (defaults to nil if omitted).