News for hackers. Stuff that matters.
Re:Thinking in React Hooks by kgwxd on Thursday December 12, 2019 @12:00PM (#21773637)
1 language vs 2 intertwined languages is compelling enough for me.
Re:Thinking in React Hooks by ng12 on Thursday December 12, 2019 @12:09PM (#21773740)
Do you mean JSX? Here you go:

    import {createElement as h} from "react"
    const Counter = () => {
      const [count, setCount] = React.useState(0)
      return h("div", {},
        h("p", {}, `You have clicked the button ${count} times`),
        h("button", {onClick: () => setCount(count => count + 1)}, "Increment")
      )
    }
There are additionally libs like hyperscript (https://github.com/mlmorg/react-hyperscript) that take the non-JSX approach further. Although honestly, I don't recommend it. JSX is really great even it seems a little unfamiliar.
Re:Thinking in React Hooks by ArchReaper on Thursday December 12, 2019 @06:33PM (#21777712)
What? JSX allows you to write HTML as though you are actually writing HTML.

The '1 language' version requires you to learn language-specific syntax for creating HTML elements.

How is that more compelling?

Re:Thinking in React Hooks by pgt on Friday December 13, 2019 @02:57AM (#21779885)
(not= syntax semantics)