markdown guide
 

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:

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

 

Someone covered something just like that just the other day :-P

I learned JS before the time of frameworks... that post brought back fond memories. Also frustrating ones. Very frustrating ones.

 

Thanks for the link. I had actually bookmarked it, but didn't have time to read yet. It probably had a subconscious impact on me. =)

I can imagine the frustrating memories!

 

Some people still write it like that. Especially using other/similar libraries like preact

Classic DEV Post from Jun 19

Is GraphQL the future of APIs?

Graphs are everywhere! What are the main benefits of the data graph structure? Is GraphQL the future of APIs?

Emilie Gervais profile image
πŸ”Œ FullπŸ‘ΎStack Developer