Skip to content

Automatically initialize components #3

Description

@stancl

We'll do this in 0.2.x once alpinejs/alpine#1166 is merged

init() is aware of the component data & element (unlike the constructor), so it can add HTML attributes similarly to x-spread. Combined with automatic invocation of init(), it will be possible to use this package like this:

<div x-data="Alpine.component('foo')()">

And the foo component will be capable of adding attributes to the root element, setting state in init(), and everything else — automatically.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions