News for hackers. Stuff that matters.
Re:How I converted my React app to VanillaJS by tomcam on Monday January 02, 2017 @06:30AM (#13300545)
Sorry, it was the syntax up to the makeElement(`h1`); that I didn't understand:

  const h1 = () =>
Is this new syntax declaring a function named h1 that returns a function or what? I don't understand what the empty pair of parentheses means.
Re:How I converted my React app to VanillaJS by k__ on Monday January 02, 2017 @06:43AM (#13300588)
Yes, this is a shortcut for:

    const h1 = function() {
      return makeElement('h1');
    }
Arrow functions without arguments need empty paranthesis.

They also have an implicit return if you don't use {}

Re:How I converted my React app to VanillaJS by pluma on Monday January 02, 2017 @07:17AM (#13300722)
To add to the other explanations: it's also important to point out that arrow functions are slightly different from regular functions in that they don't redefine `arguments` and `this` so these keywords behave like any other variable would in a closure.

So it's not just a syntactic shorthand but there's also a semantic difference.

Re:How I converted my React app to VanillaJS by teniutza on Monday January 02, 2017 @06:37AM (#13300568)
Yes, it's ES6/ES2015. It's a lambda function ("fat arrow notation"). In the parentheses you would specify the arguments. An empty pair of parentheses means that the function does not expect any parameters.
Re:How I converted my React app to VanillaJS by tomcam on Monday January 02, 2017 @06:43AM (#13300590)
OK, thanks. So it is the parameter list, not the return value
Re:How I converted my React app to VanillaJS by mattnewton on Monday January 02, 2017 @10:16AM (#13301542)
This is declaring a constant and assigning a function that takes no arguments to that constant.