It's not really that bad.
const h = React.createElement const App = (paragraphs) => h('div', null, [ h('h1', { class: 'title' }, 'Hello World!'), h('div', { class: 'content' }, paragraphs.map(text => h('p', null, text)) ), ])
Or if that h at the beginning of the line annoys you:
h
const h = React.createElement const div = h.bind(null, 'div') const h1 = h.bind(null, 'h1') const p = h.bind(null, 'p') const App = (paragraphs) => div(null, [ h1({ class: 'title' }, 'Hello World!'), div({ class: 'content' }, paragraphs.map(text => p(null, text)) ), ])
Personally, I think that the biggest advantage of jsx is that people are used to writing HTML, but once you get used to plain functions, it doesn't make a difference.
It looks a lot "cleaner" in JSX imo, but yeah maybe it's because we're used to it.
JSX is one of my favorite things to use these days. It really simplifies building templates in JS
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's not really that bad.
Or if that
h
at the beginning of the line annoys you:Personally, I think that the biggest advantage of jsx is that people are used to writing HTML, but once you get used to plain functions, it doesn't make a difference.
It looks a lot "cleaner" in JSX imo, but yeah maybe it's because we're used to it.
JSX is one of my favorite things to use these days. It really simplifies building templates in JS