{"action":"created","issue":{"url":"https://api.github.com/repos/developit/preact/issues/103","repository_url":"https://api.github.com/repos/developit/preact","labels_url":"https://api.github.com/repos/developit/preact/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/developit/preact/issues/103/comments","events_url":"https://api.github.com/repos/developit/preact/issues/103/events","html_url":"https://github.com/developit/preact/issues/103","id":142610129,"number":103,"title":"What's the reason behind using class instead of className?","user":{"login":"idchlife","id":4563032,"avatar_url":"https://avatars.githubusercontent.com/u/4563032?v=3","gravatar_id":"","url":"https://api.github.com/users/idchlife","html_url":"https://github.com/idchlife","followers_url":"https://api.github.com/users/idchlife/followers","following_url":"https://api.github.com/users/idchlife/following{/other_user}","gists_url":"https://api.github.com/users/idchlife/gists{/gist_id}","starred_url":"https://api.github.com/users/idchlife/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idchlife/subscriptions","organizations_url":"https://api.github.com/users/idchlife/orgs","repos_url":"https://api.github.com/users/idchlife/repos","events_url":"https://api.github.com/users/idchlife/events{/privacy}","received_events_url":"https://api.github.com/users/idchlife/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-03-22T10:41:36Z","updated_at":"2016-06-25T18:36:06Z","closed_at":"2016-03-22T18:35:03Z","body":"I've been thinking, why class but not className? If I'm not mistaken, className in react used due to Element.className and not Element.class. Why class here? If suddenly someone would try to switch-and-go to react or similar, he will experience huge compatibility issues.\r\n\r\nOr there is no goal in the end - for preact to be total drop-in-replacement but to be something new?"},"comment":{"url":"https://api.github.com/repos/developit/preact/issues/comments/228563999","html_url":"https://github.com/developit/preact/issues/103#issuecomment-228563999","issue_url":"https://api.github.com/repos/developit/preact/issues/103","id":228563999,"user":{"login":"developit","id":105127,"avatar_url":"https://avatars.githubusercontent.com/u/105127?v=3","gravatar_id":"","url":"https://api.github.com/users/developit","html_url":"https://github.com/developit","followers_url":"https://api.github.com/users/developit/followers","following_url":"https://api.github.com/users/developit/following{/other_user}","gists_url":"https://api.github.com/users/developit/gists{/gist_id}","starred_url":"https://api.github.com/users/developit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/developit/subscriptions","organizations_url":"https://api.github.com/users/developit/orgs","repos_url":"https://api.github.com/users/developit/repos","events_url":"https://api.github.com/users/developit/events{/privacy}","received_events_url":"https://api.github.com/users/developit/received_events","type":"User","site_admin":false},"created_at":"2016-06-25T18:36:06Z","updated_at":"2016-06-25T18:36:06Z","body":"@AlexAThomas Preact support both properties. If you prefer `className`, you can use it as you would normally.\r\n\r\nPreact intentionally defaults to `class` because React's original reasons for choosing `className` ended up not making much sense, though it took a couple of years to see this and they're stuck with the name now.  `className` was originally chosen because that's the DOM property name, but in reality the value of that prop gets transformed prior to being used anyway - this means the name is shared, but the semantics are not.  Another original reason was because `props.class` throws in IE8 - however, this doesn't provide justification anymore since IE8 is no longer relevant/supported, and Babel & UglifyJS auto-escape keyword properties (`props['class']`) to avoid the bug.\r\n\r\nPreact also ships with object `class` / `className` support by default, which further separates the semantics of JSX class/className from the DOM `className` property, which can only be a String.\r\n\r\n```js\r\n<a class={{ foo:true, bar:false }} /> // equivalent to: <a class=\"foo\" />\r\n```\r\n\r\nLet me know if this answers your question - I know it can be strange to see intentional differences in a library that is otherwise so similar to React, but these are part of the reason Preact exists. It is a library that has no growth baggage, and thus can make decisions that build on a few years of learning in this space."}}
{"actor":{"display_login":"developit"}}