Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I read props? #62

Closed
AleksandrHovhannisyan opened this issue Oct 30, 2022 · 4 comments
Closed

How do I read props? #62

AleksandrHovhannisyan opened this issue Oct 30, 2022 · 4 comments

Comments

@AleksandrHovhannisyan
Copy link

The docs note that you can declare private props on webc components using the special @ syntax, but they don't clarify how to access this data in JavaScript:

Make any attribute into a prop by prefixing it with @. Props are “private” attributes that don’t end up in the output HTML (they are private to WebC). They will be filtered from the output HTML but are available to the component’s data.

This is the example from the docs:

<my-component @propName="Hello"></my-component>
  1. Where is propName accessible in the web component?
  2. Do we still need to use @ wherever we access it in JavaScript or do we drop that?
@AleksandrHovhannisyan
Copy link
Author

Sorry, duplicate of 11ty/eleventy-plugin-webc#23

@zachleat
Copy link
Member

zachleat commented Nov 2, 2022

@voxpelli
Copy link

For future reference: @propName is accessed within the component as propname, not propName

@zachleat
Copy link
Member

@voxpelli filed this one for discussion: #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants