r/reactjs • • Dec 02 '21

Meta Coding Interview with Dan Abramov

https://www.youtube.com/watch?v=XEt09iK8IXs
618 Upvotes

140 comments sorted by

87

u/camouflage365 Dec 02 '21 edited Dec 02 '21

His answer about when to use Redux is pretty fascinating, honestly.

Edit:

Will also say that it's awesome for him to put himself out there and do this!

37

u/azangru Dec 02 '21

What is it? :-) I am unlikely to watch the video, but am curious. Is he saying "never"? That would be a laugh.

7

u/camouflage365 Dec 02 '21

Basically yes, lol. It's actually a pretty stark contrast to what is, for example, touted here.

6

u/landisdesign Dec 02 '21

It seems to me like it really depends how usable your server data is on the front end. If it's highly normalized and needs to be aggregated to be useful in your app, you need to do that aggregation somewhere.

If you've got bandwidth to support a BFF like Apollo, you probably don't need much heavy lifting in the browser, and Redux becomes unnecessary.

If you don't have the bandwidth to support a BFF, and the normalized DB model is pretty hard to stitch together, you may want to use selectors and reducers to stitch it all together in the browser.

It kinda depends on where you can do that kind of lift, on the server or in the browser. The work has to happen somewhere.

EDIT: I personally use and love Redux/RTK/re-reselect. But I can see the use case for doing that work on the server.

22

u/Cptkrush Dec 02 '21

It’s honestly refreshing when the creator of it is the one saying “hey shit has gotten better than this, you can stop building new projects with it”. Makes me feel better about choosing not to use it in new apps at work due to the added complexity with very little benefit for the scale of our needs. That was definitely something I waffled on when architecting my last project.

5

u/[deleted] Dec 03 '21

There's been a "you probably don't need redux" on the redux docs for years. People choose to ignore it.

Redux had it place before hooks, context, relay and other stuff, it's hard to justify it in 2021.

→ More replies (1)
→ More replies (4)

77

u/MistakeNot__ Dec 02 '21

Pretty much. He said he would use redux only if your team already used it on a project, and you've exhausted all other options for storing this particulatlr piece of state.

14

u/[deleted] Dec 02 '21

What does he recommend for state management?

I wonder if he’s aware of redux toolkit and if he thinks it’s an improvement.

50

u/landisdesign Dec 02 '21 edited Dec 02 '21

He suggests using a BFF like Apollo, then cache the queries with Relay etc.

It makes sense, especially if you've got the developer and resource bandwidth for a GraphQL server. (I'm the front-end guy on a team of two, and I personally don't.) The less data stitching you have to do on the front end, the better.

For me, I inherited Redux, and I have to stitch together literally dozens of API's for a dizen different DB tables on the front end, so it works. ¯_(ツ)_/¯

As one of the original creators of Redux, I'm pretty sure he knows about RTK. It's just part of a different paradigm than BFF/GraphQL.

EDIT: Never mind about my assumptions about Dan's familiarity with RTK. See u/acemarke's comment below.

127

u/acemarke Dec 02 '21 edited Dec 05 '21

As one of the original creators of Redux, I'm pretty sure he knows about RTK

I'll be honest: No, Dan knows almost nothing about "modern Redux". (Please note that I'm not attacking him here - I'm just clarifying what I think he does and doesn't actually know.)

edit I apparently over-spoke here. Per Dan's comment below, he has had some time to go through the RTK/RTKQ docs and source at some point.

He basically stopped paying attention to it in mid-2016 when he handed the maintainer keys to Tim Dorr and myself, and over the last couple years he's switched to actively disliking it. He has occasionally popped into issue threads to leave comments (like suggesting in the React-Redux hooks API design thread that we drop the useRedux hook and drop the idea of "binding action creators"), but that's it. Other than that, he has been entirely uninvolved with Redux.

I understand where he's coming from. He's deep inside of his work on React, and Redux's architecture is in some ways a barrier to what the React team wants to make possible with Suspense / Concurrent rendering. Additionally, he's busy and doesn't have time to spend looking at all the stuff the Redux team has since then.

But at the same time, from what I've seen he truly is not familiar with RTK, RTK Query, how we've changed our tutorials, the Style Guide, or pretty much any of the other stuff we've done in the last few years. He knows RTK exists because I keep mentioning it in Twitter threads where he's involved, but as far as I know he hasn't ever taken the time to go read through the docs or try RTK. I've also seen seen that lack of familiarity come up in some discussions with the React team in general - like, they're aware that Redux is frequently used, but they're really not familiar with the details of how most people use Redux overall.

So, I understand his perspective, but I would also have to suggest taking any of Dan's opinions on Redux at this point with a bit of a grain of salt on the grounds that he is no longer familiar with how Redux is used by the community.

22

u/gaearon React core team Dec 05 '21

Just to slightly correct this, I've read through RTK Query docs (as well as parts of the source) several times before. While it is possible to implement pretty much anything (including a cache layer) on top of the Redux architecture, I personally find that there's a lot more indirection (expressing all internal workings as actions, middleware, etc) than I'm comfortable with. I hope it's ok for me to have that opinion. :)

→ More replies (3)
→ More replies (16)

9

u/[deleted] Dec 02 '21

Oh wow, first I’m hearing about BFF patterns. Is that popular and worth looking into to?

18

u/landisdesign Dec 02 '21

Basically the idea of "Back end For Front end". With microservices, typically most of the services are designed to talk with each other. A lot of times the front end has to use the same API calls, which can be a pain, because they weren't made to be consumed by the front end, really. The front end ends up having to combine all this data.

With a BFF, there's another microservice that collects the back-end API calls and presents a set of API's that actually make sense for the front end to call.

→ More replies (5)
→ More replies (1)
→ More replies (3)

7

u/azangru Dec 02 '21

I wonder if he’s aware of redux toolkit and if he thinks it’s an improvement.

He most certainly is; but I doubt he has been building any large-scale applications recently and has had a chance to battle-test it.

1

u/ib4nez Dec 03 '21

Pretty new to react, more used to vue and angular - what does he suggest for when, say, you have a username/id that multiple unrelated components need access to? I don’t want to make an http request every time I need it, and some centralised store sounds like the ideal solution?

Just a bit confused as to why he suggests not using state management for state management

3

u/reflectiveSingleton Dec 03 '21

I'm not him, but a common answer would be to use React Context

→ More replies (1)
→ More replies (2)

6

u/wwww4all Dec 03 '21

My answer for when to use Redux is, if you want a job, always use Redux, RTK, RTK query, etc. Learn "classic" Redux if you have the time, there are many, many legacy codebases to maintain at large companies.

javascript/React/Redux, those three words will overflow your Linkedin message box by recruiters.

41

u/jftf Dec 02 '21

My impostor syndrome temporarily subsided with the centering task. Ben Awad could hardly contain himself.

10

u/camouflage365 Dec 02 '21

Tooo be fair, just for the people who might not get it, he knows he could have thrown on a 100vh height property and called it a day, but he felt that was bad practice. The confusion was mostly centered around why the container wasn't sizing properly.

→ More replies (2)

38

u/CPU1 Dec 02 '21

https://overreacted.io/things-i-dont-know-as-of-2018/

Here's some more impostor syndrome subsiding content from Dan Abramov.

18

u/GoOsTT Dec 02 '21

Starting a new junior dev position in February. This will be my go to read before my first meeting and whenever I feel bad or lost.

5

u/[deleted] Dec 03 '21

Knowing what you don't know is half the battle!

4

u/noneofthatmatters Dec 03 '21

Wow some of these were really surprising. That's awesome -- thanks for sharing!

4

u/tacobasket Dec 03 '21

This is incredible, thank you. Next interview when they ask me about these, my go-to response will be "you know, I read in his blog that Dan Abramov doesn't even know what that is. Do you think it's useful if I do?" 😂

→ More replies (1)

8

u/wwww4all Dec 03 '21

All jokes aside, learn to center the div using flex.

Practice it every day, until you have commited it to memory and muscle memory.

So often, it just flow out.

You can do this during interviews and get that job.

4

u/el_diego Dec 02 '21

I actually love this kind of stuff. Our media (Twitter, Reddit, etc.) props up influencers like they are all knowing beings, but in reality they're all just like us. They can also struggle with things that are seemingly simple.

49

u/fermion72 Dec 02 '21

Oh, if only I got a question as easy as let -vs- const in a programming interview...

19

u/[deleted] Dec 03 '21

Meanwhile I get, from easiest to hardest:

  • let vs var in loops

  • usual odd hoisting and closure quizzes

  • how many times is console.log executed? Array(5).map(_=>console.log("called"))

  • what does this evaluate to: 3 > 2 > 1

  • how can you make a === 1 && a === 2 && a === 3 evaluate to true

  • how do you check if an object is empty, including non enumerables

They aren't impossible, but god I hate those.

15

u/Aoshi_ Dec 03 '21 edited Jun 04 '23

I want to write this for my own sake, but also to see if I'm right and would love any improvements. I'll block out my answers in case another newbie wants to try.

let vs var in loops - let and const are blocked scoped. var is function/global scoped.

usual odd hoisting and closure quizzes - hoisting is what happens when some code is physically in memory before it is 'needed'(?) Only example I can think of is a function call is set before the function is actually written out. So the function is hoisted. Closures are still tricky for me, but I know it's how functions can retain their values even after the execution context closes. So you can access their values even after the function is executed and finished.

how many times is console.log executed? Array(5).map(_=>console.log("called")) - I actually don't quite know this one. Nothing?

what does this evaluate to: 3 > 2 > 1 - false. I remember this from JavaScript and the weird parts. Comparison symbols have an operator precedence of left to right. 3 > 2 > 1 doesn't compare them all at once, instead it goes by pairs. But this also deals with truthy and falsy values. So it compares 3 > 2 which is true and gives it a truthy value of 1. Then it compares 1 > true. 1 is not greater than 1, so false.

how can you make a === 1 && a === 2 && a === 3 evaluate to true? - I had no idea. I googled the answer with creating an 'a' object and converting the contents into a string and incrementing. I barely understand that and definitely wouldn't get that right in an interview.

how do you check if an object is empty, including non enumerables - Only thing I can think of really is using Object.keys(emptyObject) which would return an empty array.

6

u/[deleted] Dec 03 '21

Good. The one you didn't think immediately for: a === 1 && a === 2 etc can be made true by using a getter that does a++ every time you try to read a.

It's a shitty question.

5

u/fgutz Dec 03 '21

Array(5).map(_=>console.log("called")) - I actually don't quite know this one. Nothing?

Correct. Calling the Array constructor with a number, like Array(5), creates an array and sets the length of the array to 5 and creates 5 non-iterable empty slots. If you need to iterate you should call .fill before calling .map: Array(5).fill(0).map(_=>console.log("called"))

2

u/Aoshi_ Dec 03 '21

Thanks! That makes a bit more sense. I rarely, if ever use the Array constructor. I had never seen [empty × 5] before.

Is there a difference between new Array() and Array()? Is it the same constructor?

→ More replies (1)

1

u/csorfab Dec 04 '21

how can you make a === 1 && a === 2 && a === 3 evaluate to true? -

try this in node or your browser console :)

(() => { let counter = 1; Object.defineProperty(globalThis, "a", { get: () => counter++ }); })() 
console.log(a === 1 && a === 2 && a === 3)

5

u/pasih Dec 03 '21

I’ve been coding JS (and other stuff) for more than a decade (almost two actually) and I’ve delivered dozens of non-trivial web apps to production.

I haven’t the faintest what 3 > 2 > 1 evaluates to. What a stupid question. I hope we’ll grow out of these types of interview questions eventually.

Good luck for your job hunt. :)

2

u/[deleted] Dec 03 '21

Well, I think that `3 > 2 > 1` is a fair evaluation question. If you know evaluation is left from right 3 > 2 is true, and true > 1 is false which makes it all false.

2

u/gaearon React core team Dec 05 '21 edited Dec 05 '21

Btw I wouldn't be able to answer this one. From my perspective, what's important to know is that evaluation order exists and that whenever you see this kind of code, you want to check it and put parentheses for the next person to not get confused. (With the added caveat that this particular piece of code is nonsensical since it always compares boolean with a number regardless of what evaluation order is.)

3

u/Soysaucetime Dec 03 '21

What's the answer to the a === 1 etc question? Unless you can increment a between comparisons, I have no idea.

1

u/[deleted] Dec 03 '21 edited Dec 03 '21

Yes, good intuition.

I don't remember the exact code and I'm not on pc but I think it's something like

Object.assign(global, "a", {
  get() {
    a++;
  }
})

a = 0;

and then do the evaluation that will be true.

Probably few syntax mistakes, but the point is basically adding the variable to the global object and add a getter that will increment the value every time you access the value.

1

u/cjthomp Dec 03 '21

You might be surprised how many people would absolutely bomb that question...

1

u/19061988 Dec 02 '21

Oh, if only I got a question as easy as

let

-vs-

const

in a programming interview...

I've been asking this question for years now, used to be hiring in Europe though.

-11

u/smirk79 Dec 02 '21

Yeah, right? Wow, amazing that you can answer that const is constant. Here’s your six figure salary and stock options…

23

u/camouflage365 Dec 02 '21

It's not a real job interview, and it's still interesting to hear how Dan answers relatively simple questions. I think he's the closest you can get to a "rock star" in the modern dev community. Technologies he's associated with have transformed the lives of countless people here (new devs), and like I said in another comment, for him to be humble enough to even put himself out there and do this, is pretty remarkable.

0

u/[deleted] Dec 02 '21

[deleted]

5

u/[deleted] Dec 03 '21

Hint: those questions are mostly used as ice breakers to relieve some stress off the interviewed.

Obviously, these can often ring alarm bells if poorly handled.

4

u/TracerBulletX Dec 03 '21

I think it depends on how you use the information. Talking about "trivia" can be a valid way to just assess how experienced and familiar someone is with a subset of technologies. You have to follow some rules though, you can't penalize someone for not knowing about a specific thing, just use the depth of their answers overall to build evidence that they are familiar with a topic. Like if you ask someone about CSS variables and they give you this great answer about all the trade-offs involved and tell you about their personal pattern for using them that's evidence they have some legit experience. Or if you're interviewing someone who is a Go engineer and they tell you what they think of the introduction of generics and how it would impact the code they write. It's an opportunity to display your engagement with the industry. You also have to let the candidate go in the direction of the things they do know and don't worry about the areas they don't know and assume if they learned one area they can learn the ones your company uses.

2

u/[deleted] Dec 03 '21

I’ve genuinely never used “let” in any application I’ve ever written. And it hasn’t stopped me from writing maintainable applications quickly.

Agreed, but one very typical use case I find for using let is when a variable needs a default, but can change depending on something else, i.e.,

let someVar = 'some content';
if (someOtherVar === 'some very specific thing') {
	someVar = 'something else';
}

You might say, but why not

const someVar = 
	someOtherVar === 'some very specific thing' 
		? 'something else' 
		: 'some content';

Which is fine until you start adding conditions...

const someVar = 
	someOtherVar === 'some very specific thing' 
		? 'something else' : someOtherVar = 'something else specific'
		? 'some other specific thing' : 'some content'; // ad nauseam

But then I would argue that let + switch is easier to read:

let someVar = 'some content';
switch (someOtherVar) {
	case 'some very specific thing': someVar = 'something else'; break;
	case 'some very specific thing2': someVar = 'something else 2'; break;
	case 'some very specific thing3': someVar = 'something else 3'; break;
	case 'some very specific thing4': someVar = 'something else 4'; break;
	case 'some very specific thing5': someVar = 'something else 5'; break;
}

Functionally, there may not be a difference, but I find the latter style more readable. Personal preference and all that.

1

u/Yodiddlyyo Dec 03 '21

This is absolutely not true in every regard. For little things, absolutely, but I've 100% used "trivia" to weed out candidates. For example, I was interviewing people for a senior level javascript role. No framework specifically, we needed something that was very strong in javascript, how the browser works, etc. I asked about adding and removing event listeners as one of the first questions. You would not believe that amount of 5+ years of JS experience developers couldn't explain how bubbling works, or how object reference equality works - two of main important things to know when handling events, but also just Javascript and the browser in general. That could be viewed as trivia, but it was more than that, and it was definitely a red flag. I can tell you that I never failed someone specifically for answering that wrong, but I can also tell you that nobody who answered that wrong was ever hired.

28

u/Nullberri Dec 02 '21 edited Dec 02 '21

In the tree inversion he missed the terminal case, where the leafs are null.

could also do it as... but it is not space complexity equivalent as you need to store 2x the tree in memory (atleast untill GC).

const invertTree = (node) => node
    ? {
        left: invertTree(node.right),
        right: invertTree(node.left),
        value: node.value,
      }
    : null;

4

u/NotLyon Dec 02 '21

That's cool, but the requirement was "in-place". Seems like u could add Object.assign to retain the node reference. It also saves you from having to copy over the value.

1

u/franciscopresencia Dec 03 '21

Nice! Editing it a bit, I like this slightly more:

const invertTree = (node) => node && {
  left: invertTree(node.right),
  right: invertTree(node.left),
  value: node.value,
};
→ More replies (1)

0

u/[deleted] Dec 02 '21

[deleted]

5

u/smirk79 Dec 02 '21

Yours is far more readable.

2

u/careseite Dec 03 '21

Hardly. Implicit return vs unnecessary destructuring

3

u/Nullberri Dec 02 '21 edited Dec 02 '21

I actually prefer yours, for readability.

Edit: On my initial read i did not notice you do the swap early, I think that really obfuscates what's going on.

const invert = node => {
  if (node === null){ return null; } //if's always get brackets, some one will try to alter it and forget to include them.
  const{ value, left, right} = node; 
  return { value, left: invert(right), right: invert(left) }; // do the swap were the important parts happen so its easy to see that we did in fact swap.
};

1

u/tills1993 Dec 03 '21

The one liner is ok. It's completely unnecessary for it to be a one liner. Yours is objectively better.

It's also wrong as the assignment was for the function to invert in-place.

23

u/maximoburrito Dec 02 '21

I think invertTree needs to check for null at the beginning or before recursing, otherwise it never terminates.

4

u/mrbotmd Dec 03 '21 edited Dec 05 '21

In YouTube comments Dan said, that if interviewer didn't see this mistake, then it's fair game.

3

u/gaearon React core team Dec 05 '21

It terminates but throws. :) Yea that's a mistake. I've relaxed too much after Ben saying this is correct and didn't double-check the solution. (I'm hoping I would have caught then, but maybe not!)

50

u/[deleted] Dec 02 '21

Watching him "struggle" with centering something made me feel good inside as someone that struggles to remember the syntax of a for loop sometimes.

10

u/[deleted] Dec 02 '21

snippets til I die

-4

u/andrei9669 Dec 02 '21

that's why I always use arr.forEach(), so much easier to remember.

0

u/josefbud Dec 02 '21

Doesn’t work with promises though. It executes the loop on each element without waiting for the first one to finish.

If you want easy syntax for (element of array) works well and still works with promises.

And even besides that, forEach is about 33% slower than a for loop.

4

u/andrei9669 Dec 03 '21

If you wait for a promise in a for loop then that is suboptimal. Imagine you have 100 requests to make, instead of doing them one at a time you could do them all at once and then do Promise.allSettled to check if they suceeded or not.

And if you worry about that 33% of performance overhead then you have bigger problems than a for loop. But if you do have performace issues and you can't optimize it anywhere else, then you can use the traditional for loop.

3

u/careseite Dec 03 '21

And even besides that, forEach is about 33% slower than a for loop.

They've been optimized recently and reduce became faster than for const of in certain cases so that statement isn't true necessarily anymore.

1

u/andrei9669 Dec 05 '21

just discovered that normal for loop is still fastest BUT, for ... of is slower than forEach

2

u/gaearon React core team Dec 05 '21

These comparisons are usually meaningless because the actual "slow" part is the code you put inside of the loop.

1

u/andrei9669 Dec 05 '21

pretty much. and I did some testing today. and I came to the conclusion, that forEach is almost the same as regular for loop.

→ More replies (2)

1

u/josefbud Dec 05 '21

Damn, that’s actually good to know. Thank you!

6

u/javanerdd Dec 03 '21

can someone clarify the bunny pattern ? tripped me up that effin bunny

4

u/thunder-thumbs Dec 02 '21

I quickly intuited that worst case was 200 but I was wrong as to why. My first thought was that I could check each bucket twice (in a row), which after thought wouldn’t have worked. Then they did all their stuff and ended up coming to 200 for a completely different reason. So I fail. :). Probably not 200 though right? 199 I think.

3

u/MallardD Dec 02 '21

Why wouldn't checking twice in a row work? It can't pass you if you check twice and eventually will be either on your second guess at the same hole or in the last hole you check.

5

u/thunder-thumbs Dec 02 '21

Let’s say you guess 2 when it’s on 4. Then you guess 2 again when it’s on 3. Then if you move on to 3 it could have jumped to 2 and you’ve passed each other.

1

u/MallardD Dec 03 '21

Ah I see now, thanks!

2

u/[deleted] Dec 02 '21

Wow.

2

u/Skatedivona Dec 03 '21

Dan the man!

2

u/enigmaBabei Dec 03 '21

Now, he definitely feels like a normal person. lmao

1

u/moniv999 Mar 26 '25

You can practise on sites like PrepareFrontend, GreatFrontend, Leetcode for your interview prepration.
Try going through basics & easy DSA.

1

u/reddit_ronin Dec 02 '21

Thanks for posting this. Bookmarked for later.

0

u/cjthomp Dec 03 '21

This is fascinating. This is the content I'm here for.

-2

u/noknockers Dec 02 '21

There's multiple ways to centre stuff depending if he wanted just the text centred or the text entire container centred. An then, there's still multiple ways for each.

-5

u/fatnote Dec 03 '21

Is it me or did that interview go horribly?

  • Let v const: Dan's answer was so flippant, my conclusion would be that this person doesn't understand the (basic) protection that const provides, but even worse, doesn't follow consistent code styles within his own code.

  • Binary tree inversion: how about a simple test dude? Or at least run your code to make sure you haven't done something stupid? Tbf the problem is really simple, but then why all the posturing about "I have the record but you may have beaten it"? Bizarre.

  • When would you use redux? "If the team are already using it" - what?? That's a shocking response, and it didn't improve much after that. It's the kind of thing someone says if they have no idea what redux does. Again, bizarre.

Personally, I wouldn't hire someone based on that. But then again I might have asked very different questions.

7

u/Jacob_Snell01 Dec 03 '21

Well he’s not actually interviewing. The interesting thing about interviewing someone like him for a React position is seeing how he feels/thinks about these questions that a lot of us assume are valid questions to hire or not to hire someone.

5

u/gaearon React core team Dec 05 '21

FWIW I don't think it was a stellar interview! (Forgetting the base case in recursion is kind of embarrassing.) But let me answer these one by one:

Dan's answer was so flippant, my conclusion would be that this person doesn't understand the (basic) protection that const provides, but even worse, doesn't follow consistent code styles within his own code.

I explicitly said what "protection" const provides: it prevents reassignment but does not prevent mutation. So I don't think it's fair to say I don't "understand" it. As for the style in my personal code outside of the team... that's my personal business. :)

Binary tree inversion: how about a simple test dude? Or at least run your code to make sure you haven't done something stupid? Tbf the problem is really simple, but then why all the posturing about "I have the record but you may have beaten it"? Bizarre.

Yeah I agree it would've been good to verify it! I was elated by how easy the task is compared to what I thought "invert a binary tree" would feel like so I let my guard down. I definitely don't think I made any "records" there lol, it's just a variable swap question.

When would you use redux? "If the team are already using it" - what?? That's a shocking response, and it didn't improve much after that. It's the kind of thing someone says if they have no idea what redux does. Again, bizarre.

We obviously disagree on this, but I think it's reasonable to say that I can't think of a particular case where I'd reach for a tool but I'd use it if the team is already using it. I'm not sure why you think a response like this is shocking. I did clarify what kinds of tools I would reach for first.

2

u/fatnote Dec 05 '21

Dan, first of all thank you for responding, always appreciated!

Yes, you did explain the difference between let and const, but you seemed to downplay its importance, and I found that strange. Also I didn't realise you were talking about personal code. I guess I just feel strongly about const over let, and also about the importance of consistent style (within a team).

Re: redux, looking at it from the interviewer's POV, when I ask a question like this, it's because I want to verify that you understand what that tool/library does and when it should / shouldn't be used. "The team are already using it" doesn't tell me anything about you, and it makes me suspect that you didn't actually understand the question, and maybe you're stalling for time. Mentioning the alternatives was interesting, but maybe I wanted to hear you say "here's what's wrong with redux". And maybe you didn't because you've said it before, but outside of this interview.

Maybe I took that video too seriously. I thought it was an experiment where you would behave exactly as you would in a real interview, and that the purpose was to demonstrate how to do well at these interviews, or why these interviews are hard, or maybe highlight what's wrong with interviews today. And there was some of that, but I got the sense that you weren't taking it very seriously. But maybe I missed the point!

2

u/gaearon React core team Dec 05 '21 edited Dec 05 '21

but you seemed to downplay its importance, and I found that strange [...] I guess I just feel strongly about const over let

I genuinely don't think it's important. (Sorry!) I've been writing code for 17 years (out of those, 12 professionally) in a few different languages and I hope I've earned my right to have an opinion on this. I wrote a slightly longer version here. I understand you feel differently, but I don't know if us having differing opinions means I'm wrong.

also about the importance of consistent style (within a team).

I'm with you on consistent style — which is why I said I'd follow the project conventions. If I'm on a prefer-const team, sure, I'll const it all out.

Also I didn't realise you were talking about personal code.

After I explained the difference and said I'd use whatever people already use on the project (because I don't care), Ben asked what I do in my personal projects. And because I don't care, I use whatever.

Mentioning the alternatives was interesting, but maybe I wanted to hear you say "here's what's wrong with redux". And maybe you didn't because you've said it before, but outside of this interview.

There's nothing "wrong" with it. It's just that for each use cases I can think of at the moment, there is a purpose-built tool that I would prefer to use instead. So I wouldn't add it unless I ran out of those purpose-built tools.

Let me give you an analogy. I have a nice jacket. But I never wear it because for each type of occasion, I have something that fits me better. This doesn't mean there's something "wrong" with the jacket. Also, if somebody asked me to wear it, I would. But I just don't have much use for it.

It could be interesting to go in more depth about each particular case and why in each of those cases, I prefer some purpose-built solution. If the interviewer asked that I'd be happy to oblige. Though this might take the entire hour.

I thought it was an experiment where you would behave exactly as you would in a real interview, and that the purpose was to demonstrate how to do well at these interviews, or why these interviews are hard, or maybe highlight what's wrong with interviews today. And there was some of that, but I got the sense that you weren't taking it very seriously.

I'd say I did behave like I would in an interview — which is to plainly state my thoughts on the subject rather than try to guess what the interviewer wants to hear. I think it is interesting that people see the performance as weak and objectionable. I guess what you carry away from it is a question to you (as a viewer) and not me.

1

u/fatnote Dec 05 '21

Great article. I think I still come down on the "prefer const" side, but I certainly wouldn't call your argument "wrong".

The redux jacket is an excellent analogy.

I'm curious, have you ever had an interview where you thought "that went really well" and then you got a rejection? (this has happened to me, I would guess it has happened to most people)

1

u/[deleted] Apr 30 '22

Your vs his way of thinking is precisely why he's accomplished great things for the community and also why most didn't even achieve the tenth.

1

u/[deleted] Apr 30 '22

Your vs his way of thinking is precisely why he's accomplished great things for the community and also why most didn't even achieve the tenth.

10

u/Fleaaa Dec 03 '21

When would you use redux? "If the team are already using it" - what?? That's a shocking response, and it didn't improve much after that. It's the kind of thing someone says if they have no idea what redux does. Again, bizarre.

He basically created redux jesus.. ecosystem is evolving and it's different thing from the past was his point.

3

u/fatnote Dec 03 '21

I am well aware.

My point is that if someone answers a question like that, it sounds like they don't know what they're talking about.

So maybe Dan is just not great in interviews? Which I suppose means that he proved himself by his work as opposed to answering questions like these, which is a good thing.

But still... Communicating your opinion clearly is a valuable skill, and it doesn't come across well at all here.

6

u/Fleaaa Dec 03 '21

Well to be fair I still think his POV was valid, if he thinks a certain tech doesn't fit into the project, why would he say otherwise? Especially from the beginning everyone aware of the fact that he created the tech. To me It just shows the picture how hiring process is absurd and twisted. Don't give an straight answer that fits to the project? wrong.

I mean obviously we don't know the whole and he's not exactly in applicant's mindset, but it's a bit strange to say something like that.

-3

u/fatnote Dec 03 '21

A good answer would be something like "Redux is appropriate for projects that do X and Y, but I think that P and Q are actually better alternatives". That's not what he said.

0

u/[deleted] Dec 03 '21

[deleted]

0

u/fatnote Dec 03 '21

That would also be a good answer, but that's not what he said either. He started off by saying "if the team are already using it" which is just not an insightful comment at all.

0

u/thebokehwokeh Dec 03 '21

You’re aware Dan literally created redux by himself right?

2

u/fatnote Dec 03 '21

Yes, hence the bizarreness

2

u/enigmaBabei Dec 03 '21

I think it's more about chance and interest in his creation of redux and here i feel he is just out of practice.

0

u/[deleted] Dec 03 '21

[deleted]

1

u/gaearon React core team Dec 05 '21

I'm not "uninterested" in webdev innovations at all. I've seen enough "innovations" come and go that I'm trying to be more discerning between novelty and when a project is actually moving the needle. I'm glad the interview made you feel good.

0

u/ui-dev Dec 03 '21

Next try to roast the other guy in an interview....err Mark whats his name. You know Dans big boss.