4 ms·
Great stuff! var tag = React.createElement Could make the code nicer to read...
by mbrock 11y ago
Great stuff!
var tag = React.createElement
Could make the code nicer to read...
- wereHamster 11y agoor even h1 = React.createFactory('h1'), ... and so on for every that you use in the file, and then use h1({}, 'text') in the code.
- brianshaler 11y agoWhat about h1 = React.DOM.h1;? Personally, I moved from using DOM tag names as variable names ('a' being the worst) to saving 'var DOM = React.DOM' (or '{DOM} = React') and then calling DOM.a(props, children...)
- niothiel 11y agoMithril.js uses 'm()'. Check it out: http://mithril.js.org http://mithril.js.org
- antris 11y agoYou've hit the nail on the head. I've never seen a fair JSX vs. React.createElement comparison on a blog post. The latter is never given even a basic refactoring such as you and your child comment suggested.
- Aleman360 11y agoThe verbosity makes things easier to understand for beginners.