Hacker News new | ask | show | jobs
by geelen 4300 days ago
You can definitely do this, though I think "data-am-" is better to avoid conflicts. React ignores unexpected attributes at the moment, but can't forever with Custom Elements (since it can't know what valid attributes for new elements are).

We've got an open discussion on this point, if you want to contribute there: https://github.com/amcss/attribute-module-specification/issu...

2 comments

I wouldn't completely assume react is going to give on that. In React you can create any custom properties you want to because it's just JS. The problem is how to interop with Web Components and from what I've seen nobody is really interested (rightfully so) in that
"data-am-" would be a good choice indeed :)
Absolutely! The prefix is optional (but recommended). If you're comfortable with data attributes (or, they're required for some reason), thats cool too.