Ready to get started?

Join Adocasts+ for $8/mo or sign into your account to get access to all of our lessons.

EdgeJS Components #2.1

Component State & Passing State from EdgeJS to ApineJS

In this lesson, we'll take a look at how we can define and manage state within EdgeJS Components. We'll also learn how we can pass single properties or full objects from EdgeJS to AlpineJS and our client-side scripts.

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.

Join The Discussion! (0 Comments)

Please sign in or sign up for free to join in on the dicussion.