Hacker News new | ask | show | jobs
by wildpeaks 4301 days ago
You may prefer the regular "data-" prefix (https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Usin...) to "am-", especially if you want to be compatible with React.
1 comments

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...

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.