In this lesson, we’ll focus on managing component state using EdgeJS and how we can pass state from EdgeJS into AlpineJS.
EdgeJS State
The easiest way that we can set state within an EdgeJS Component is via the set tag (@set
). The set tag is going to allow us to set a local variable that will only exist inside of this particular component.
When defined at the top of our component file, it’ll be unique to its particular component instance and won’t be shared with other components or pages.
When defined inside a block, like an @each
or @if
, it’ll exist only inside that block. Similar to a tradition JavaScript variable.
Ready to get started?
Join Adocasts+ for $8/mo or sign into your account to get access to all of our lessons.