News for hackers. Stuff that matters.
Re:React Tutorial: Cloning Yelp by dan15 on Friday May 27, 2016 @12:35AM (#11783924)
Out of curiosity, why did you write the function like this:

   const MyRootComponent = (props) => {
When it's shorter and more obvious what's happening if you write them like this:

  function MyRootComponent(props) {
Re:React Tutorial: Cloning Yelp by alaskamiller on Friday May 27, 2016 @02:18AM (#11784253)
"An arrow function expression has a shorter syntax compared to function expressions and lexically binds the this value (does not bind its own this, arguments, super, or new.target). Arrow functions are always anonymous."

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:React Tutorial: Cloning Yelp by RobertKerans on Friday May 27, 2016 @08:21AM (#11785496)
Why do you want it to be anonymous in this context? I get you can drop the `return`, but I don't see how you gain anything (apart from a tiny reduction typing and a small increase in incomprehensibility) by using anonymous functions to define components (I know the pattern is used a lot in the wild, but there seems to be zero reasoning for it; lexical binding isn't really relevant here)
Re:React Tutorial: Cloning Yelp by jkrems on Friday May 27, 2016 @04:35PM (#11788793)
In this case: You're potentially closing over node's "this inside of module body === exports" which seems more confusing than helpful..?
Re:React Tutorial: Cloning Yelp by throwanem on Friday May 27, 2016 @06:23AM (#11785025)
None of which, in this context, matters; none of those is in scope where the function is defined, so it won't be closing over them anyway.