Live data from Hacker News

How Does React Tell a Class from a Function?

overreacted.io

1–10 of 142 posts

Re: How Does React Tell a Class from a Function?

#3

"Please don’t turn this into an interview question. In fact, this post is more about JavaScript than it is about React" I love this line.

“In a December, 2nd, 2018 blog post, developer Dan Abramov explained in length and in detail how React can (and/or can not) tell a Class from a Function. He wrote: ‘please don’t turn this into an interview question’ Can you define what this refers to?”

Re: How Does React Tell a Class from a Function?

#4
post #3

"Please don’t turn this into an interview question. In fact, this post is more about JavaScript than it is about React" I love this line.

“In a December, 2nd, 2018 blog post, developer Dan Abramov explained in length and in detail how React can (and/or can not) tell a Class from a Function. He wrote: ‘please don’t turn this into an interview question’ Can you define what this refers to?”

[deleted]

Re: How Does React Tell a Class from a Function?

#6
I'm really quite surprised how much time is spent worrying about Babel.

I always thought that you could just write valid JavaScript and it's completely Babel's responsibility not to screw that up.

Edit: not sure what's wrong with my comment so let me clarify:

I wouldn't have thought that library developers had to think about what other tools might do with their library. I always thought that so long as your code is valid JavaScript, Babel would faithfully transpile it down to another valid target using polyfills and whatnot.

Re: How Does React Tell a Class from a Function?

#8
post #3

"Please don’t turn this into an interview question. In fact, this post is more about JavaScript than it is about React" I love this line.

“In a December, 2nd, 2018 blog post, developer Dan Abramov explained in length and in detail how React can (and/or can not) tell a Class from a Function. He wrote: ‘please don’t turn this into an interview question’ Can you define what this refers to?”

I don't think I can answer that without knowing how this has been bound by the caller.
Post reply on HN