Skip to content

Make difference between attribute and property clearer #848

Description

@tricki

I keep seeing people using attributes in JSX and wondering why they can't pass objects to child components (for example in this issue and more recently in this StackOverflow question).

The docs are somewhat vague about the difference:

In the JavaScript ecosystem, it's common to use 'camelCase' when naming variables.

and:

When we use our component in a TSX file, an attribute uses camelCase

(which is incorrect since camelCase refers to the property instead)

Some information about how Stencil parses and transforms attributes in general (e.g. parsing strings to booleans and numbers) would also be great, but that might be outside the scope of this request.

Maybe add a link to https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes#content_versus_idl_attributes

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions