Skip to content

Parse attributes from custom element  #13

@lucasghizoni

Description

@lucasghizoni

I want to pass attribs in my custom element like this:

<my-custom-element attribute-one="[1,2,3,4]" ></my-custom-element>

and receive that into my preact component as an Array, and not a String. For now, im parsing all my props before rendering:

for(let key in this.props){
	try {
		this.props[key] = JSON.parse(this.props[key])
	} catch (e) {}
}

Do you guys think that is a nice improvement for the project? If you agree, i can make a PR with that, just let me know!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions