Ready to get started?

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

robot mascot smiling

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.

Published
Oct 29, 23
Duration
3m 36s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

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 Plus for $8.00/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.

robot comment bubble

Be the first to Comment!