I thought this interview was very realistic until you said "feel free to Google things". Yeah, I've never been on a interview where they allowed me to google anything...
I've hardly touched react, but it mostly made sense to me. I was a bit confused that the function he was calling wasn't hoisted though. Is that a typescript feature?
Only at mega corps, interviews at smaller companies are more like the above or they just want to see some code/projects and talk to you about what you've worked on.
As much as most of this makes sense to me as a Junior Webdeveloper, I find it stunning that people can write code from the get go just thinking through the application and using knowledge they've gathered over the years. I literally have to google nearly every shit that I try to make and it really puts it into perspective for me of how much I still need to learn. :)
Once you have a solid 1000 hours of solid production experience in web dev, you should be able to be in a close enough state to mirror clem's performance.
shhhiiish I tought i was the only one and I must know how to write all that without checking Everything although I understand the concepts very well and I felt like the most shit programmer ever thank you haha
this exactly is the difference between a jr dev and a senior dev, I also used to google every single little thing when I first started in this field, but as I developed a better skillset and through reading the docs countless times and books and experience it all led me to actually know how to do shit from scratch....if you are really passionate about coding you will be there in no time.
Do you know what’s even more scary than this ? An Angular interview Jokes aside I’m actually learning Angular. I might have made the wrong choice but oh well
33:06 - you'd wrap fetchNextUser in a useCallback if you wanted to satisfy the linter and pass fetchNextUser to the dependency array. This is because the function is re-allocated on render because it's within render scope, and therefore the function reference changes between renders, causing your useEffect to every time (based on shallow comparison of the dep array), so useCallback avoids that and keeps the reference the same between renders.
I would leave the interview. If I were applying for a font end position and they started asking my questions beyond the scope of the position I would tell them to have a wonderful day. That is if that is only their concern. If they started out with relative questions and then lead into it just to see the scope of everything I knew... then that would be fine. But I feel most front end specific job interviews do focus more on this style of interviewing. I mean they need to know you can do the front end stuff. Would be funny to hire someone that has mastered sorting algos but then couldn't center a div.
0:50 Make a counter 3:10 Fetch an API 14:10 Display the API data in UI components 22:06 Add a button to load more results 29:38 Bonus: fix the linter's useEffect dependency array requirement
useCallback instead of useRef - it memoizes the fetch function for ref equality, so the effect doesnt rerun on every render. UseCallback will mean that if you eventually do a refactor so the function *does* depend on some value inside the component, your compiler will yell at you until you include it as a dependency. Useref might solve the problem now, but it can hide future potential dependencies. Also, working with a ref is annoying, constantly looking up .current or forgetting to. If the function used really doesnt depend on anything in the component then it should be externalised if possible.
There's an issue with using useCallback as well. useCallback would depend on all the state variables as well, and since state is changing on each click, useCallback would also return a new function. We'll get the same lint errors like we're getting right now.
@@binaryskeptic5988 The only state I can see is the page number - i.e. only incrementing the page number (stated in the useCallback deps array) should rerun the effect - which if you think about it, is the exact behavior this component is looking for. In most if not all cases, dependencies may seem annoying at first, but eventually you understand that they declaratively get at exactly the functionality that is needed
you could use useMemo as well, by returning the fetch function itself from the hook's callback. useCallback is basically a specialization of useMemo for functions.
Several tips here: 1. Always add a default value when destructuring nested objects. Like { name: { first, last } = {} }. This will help you to avoid errors if `name` is not defined in base object. 2. You can also rename variables during destructuring to avoid shadows. Like { name: {first: firstName, last: lastName}}
thank you, that was so nice! as a junior I feel comforted seeing this type of interview, I could actually answer those questions without even typing the code. now it would be really cool to see something like this for junior+, middle, middle+ etc. levels!
I'm a Sr. They didn't ask me to code anything or provide any code. It's the jr roles where they'll want to see it. At a mid and sr level. I think the interviewer can tell because you'll be asking questions about the codebase and the design patterns, issues they have, how they release new features and so on. How many times they're late or delayed, at that time what is going on (are people working weekends and late nights). You're more worried about how the company functions at that point.
fetchNextUser() is a function that gets newly created on every render call since its defined inside the component. Wrap fetchNextUser() inside the useCallback() hook and mention the dependencies which when changed must create a new fetchNextUser(). It's a bit more efficient this way and I guess that can get rid of the lint error.
@@computeraidedyami i actuallly did.. It was not because I am smart or anything, I had to learn it for building pcf control in dynamics crm which involves learning react framework. I struggled for weeks until the idea of react components etc clicked in my brain. I still struggle with some of the difficult concepts but overall I undertand things a lot better now.
Hey Ben and Clement, nice interview! For your question at 33:11, React encourages you to wrap your fetchRandomData function in useCallback and add it to the dependency array of the useEffect to satisfy the linting 😁 Unfortunately then you'd have to handle the dependency array for the useCallback hook, but it's the "official recommendation". I liked the useRef hack though :) Nice work and entertaining content as always!!
This is really good, I've done interviews in C#, python and on regular stuff but had no idea what it looked like for front end, this is a really approachable React interview to practice with!
Bro i watched your video just like 30 mins before my web development interview and in the react section they have asked the same questions as you have asked and I have solved all those questions thanks to you 😀😀
The first thing he did right is the comment but the content is wrong so unable to solve the lint error haha But //eslint-disable-next-line should do it ~
He was at Facebook for 2 months only. Prior to that he was at Google for only 3 years. He has only been programming for 3 years. He learnt how to code 6 months before joining Google. That is why he is not that good.
To solve the eslint message you could: - Create the fetchNextUser inside the sideEffect so there's no dependency. If it's possible - however, it's been used outside the useEffect. - Otherwise, use a useCallBack function to memoize the function to avoid re-rendering and re-computing as it's a function.
If I ever get have an interviewer like this - I know it’s the kind of person I don’t want to work with. Anyone who watches someone code like that in an interview has a serious superiority complex.
For the final bit you can pass your setters in the effect, or memo it instead of ref it. But I usually don't have empty dependencies as linting error. Also, I'm almost sure that if you try to set some state while the component already unmounted you'll get a memory leak error on your log, so to go around that you can return early in the promise resolution by setting a flag on a return function of the effect
For that linter error (which I deal with weekly), take that huge function expression out of the component (it's unreadable to define those in there anyways). Your first thought will be, but now I don't have `setUserInfos` in scope. Right, so pass it as a callback function. You have one function that fetches data, creates a new merged list, and updates 2 pieces of state. It does too much anyways. Ok, but now you're thinking that you need to add `setUserInfos` to the dependency list of useEffect, and you're right back to where you started, right? That's fine, the function that comes back from `useState` is the same exact function on each render. It'll never change. Consider this snippet from the react docs: "React guarantees that setState function identity is stable and won’t change on re-renders. This is why it’s safe to omit from the useEffect or useCallback dependency list."
Awesome stuff ! what I most liked about this video is the fact that Clément was thinking out loud so we could have a better understanding on how he would solve a problem. I would love to see a second video. Thanks guys, from France PS : René Coty was a french president ;)
Thank you guys for making this video. I really enjoyed going through these questions & trying to code the solutions to test myself before watching Clément's solutions . Keep making such videos.
I like how Ben Awad puts Clement on the Hot seat... For someone who is an Expert in programming.. It's very mind blowing that still haven't forgotten the basics of programming or should I rather say the fact that they still get excited to do the small tasks... Bigups
this was pretty fun, i'd pause after Ben posted the question and tried to code the solution, the most time I wasted was trying to use fetch correctly, so i'd say just install whichever lib you're most comfortable with
seeing some React stuff ( other than algo ), was really exciting. Also learned a lot. Please try bringing many more stuffs like this. Will be happy to watch :)
I know this is beginner react interview but it was fun to be able to point out the errors before Clement figured it out. Made me feel like a genius 😂😂😂😌
@@LuisMorales-yx8di I know the fundamentals of JavaScript and how it works but I can’t make a full project without using stack overflow for help I just know how to do basic things can you look at my portfolio and tell me if you think I’m ready for react? isaiahflagg.github.io/myPortfolio/
@@LuisMorales-yx8di actually don’t look yet lol I failed to push my code to GitHub last night so my most current projects are not on my portfolio yet lol
Honestly, the first line of code Clément wrote is mind-blowing, because I have never seen it done like that anywhere. It's usually React.useState or imported directly from react. well done sir 😂
For linting error at the end, since you re-defining/assign a new value to your function variable, that is the reason why it changes and always be different. So to resolve it, use use.memo or use.callback. Another thing, why using ref stopped the error, since we still assign the value to current? 1. Ref is always stay the same regardless of touching its fields, and changing field doesn't mean changing parent pointer. 2. Useref doesn't cause a re-render. So you can change the current an any point inside render function. Cheers,
Yeah, but I'm calling that function in another function (the React component), so it should never be an issue, as far as I know. I effectively did: ``` function foo() { bar(); } const bar = () => {}; ``` This _should_ always run properly, and it indeed doesn't get flagged as problematic by the normal TypeScript type checker. Seems like it's the ESLint "no-use-before-define" rule that's a little overly protective.
@@EDToasty hoisting would matter here if foo would actually be called before bar is declared in Clement example. You would then get a reference error (if bar is declared with const, so only declaration is hoisted without any initialisation, hence the reference error) or a type error (if bar is declared with var, so declaration is hoisted and initialised with "undefined" so it is not yet initialised as a function). Since component is exported, there should be no problems
beautiful...... I'm gonna get to this level soon bro! that feeling of complete confidence in your problem solving skills is the sweetest thing in the world. Excellent work Clément
At 11:50 You can't use Await directly in UseEffect Callback. Even you can't type async directly into useEffect Callback for example useEffect( async ( )=>{ const response = await someApiCall(); } ) You have to create a new function inside the callback of useEffect and then you can use Async Await. For Example useEffect( ()=>{ async function helloWorld (){ const response = await someApiCall(); } helloWorld(); }) This is the correct approach.
the counter task was technically incorrect, should be using the function version of useState. So basically, onClick = {( ) => setCounter(current => {return current +1})}
Moving from another framework to react I love that I was able to understand all the questions and the solutions and I have learnt more from this video than from many tutorials and courses
Who else had to google half the stuff Clem was typing, even after implementing it on mutiple projects? Sigh. I have a coding interview today (my first) and while I'm grateful for stumbling upon this video, I have nowhere as much experience as Clem and I am so worried I'll mess it up. Only way is through I suppose.
I know this was fun and meant to be funny and light hearted but I had actual anxiety watching this. Even at the begging when he said can you make a button that counts up when I click it, my mind went completely blank and all of a sudden I forgot my my own name. I hate coding interviews.
I learned more off React than i ever wanted to in my life!!! It was funny with the fetchRandomData moving it up. I have that so ingrained with writing C and pascal that when it isn’t prototypes it goes up. And I did a Java spring project, and the Java guys all put it below and they were frustrated that they had to scroll up on my code :) I said: “that’s how real programmer do it.” :)
@@DaviAreiasa function is const per definition. You can't change a function after all... Well you can in assembly it's called self modifying code but that's a different story. const nameless (lambda) function or named function is a constant
This was so great. Love your videos, they’re really helping give me more confidence. One side note, never use index on as a key unless the list is immutable. Also, your fetch function was a const, so I’m not sure how the reference would be reassigned.
This is legit! I would go as far as to say it’s much more realistic for the majority of developers. Ugly but works, use the internet to cheat, print data just to see what happens, etc. thanks for both for giving this a shot.
Awesome interview! One thing I'd point out is, when you map over userInfos, you shouldn't use the idx as a key, React keys need to be unique to each item, not assigned on the spot
Checkout the video we made on Clem's channel where I do an Algo interview: ruclips.net/video/vHKzIPwWQkg/видео.html
Was not better to use the useEffect deps for refetching more?
Oke I guess you just are pointing the same which resulted in turning off rules :D
What about using useCallback for that fn instead of storing in the ref?
What font are you using?
I thought this interview was very realistic until you said "feel free to Google things". Yeah, I've never been on a interview where they allowed me to google anything...
Interview for a FRONT-END position -
"The uglier the better"
"This is my jam!"
Thanks, we'll be in touch.
Lmaooo
you forgot "I was bullied into doing this"
cool trick:
1. Know nothing about React
2. Watch this video
3. Study React for a bit
4. Come back
5. "oooh"
lol happened to me
Going to try that
I've hardly touched react, but it mostly made sense to me. I was a bit confused that the function he was calling wasn't hoisted though. Is that a typescript feature?
@@thesupercoach Could be encapsulation meaning High order function. I might be wrong here, still learning Javascript.
@@thesupercoach arrow functions don't get hoisted
How front end interviews should be: This video
How they actually are: ok so can you invert a binary tree for me please
that's the horrible truth
Ik right !! Not knowing algo and da is exactly why I choose frontend. Now they expect us to be a master in that
Just attach class invert to the tree and use this CSS:
.invert {
transform: rotate(180deg);
}
@@digibard2890 love this
Only at mega corps, interviews at smaller companies are more like the above or they just want to see some code/projects and talk to you about what you've worked on.
As much as most of this makes sense to me as a Junior Webdeveloper, I find it stunning that people can write code from the get go just thinking through the application and using knowledge they've gathered over the years. I literally have to google nearly every shit that I try to make and it really puts it into perspective for me of how much I still need to learn. :)
You will be there
Once you have a solid 1000 hours of solid production experience in web dev, you should be able to be in a close enough state to mirror clem's performance.
shhhiiish I tought i was the only one and I must know how to write all that without checking Everything although I understand the concepts very well and I felt like the most shit programmer ever thank you haha
this exactly is the difference between a jr dev and a senior dev, I also used to google every single little thing when I first started in this field, but as I developed a better skillset and through reading the docs countless times and books and experience it all led me to actually know how to do shit from scratch....if you are really passionate about coding you will be there in no time.
@@androranogajec5029 Thanks for that brilliant tip, haven't thought about that. Really glad you told me that.
Do you know what the scariest thing in the world is? Not knowing how to write a React component in a Ben Awad interview.
Do you know what’s even more scary than this ? An Angular interview
Jokes aside I’m actually learning Angular. I might have made the wrong choice but oh well
@@harispapadopoulos4295 react is easy for me but angular is tuff...
hhhhhhhhhhhhhhhhhhhhhhhh
Incorrect, the scariest thing is getting a high paying job writing Angular code... gulp
Ahahahah good one
gender: “female”
name: Object
8:32
HAHAHA
lmao
bruh i saw that too
Secret coding interview technique. Having sexist code gives you a higher acceptance rate at faang!
Isnt that all women?
I wish every tech interview was as friendly
Yup
they usually are
Never met one that wasn't this friendly
Maybe it's just in your mind the anxiety
You've said it all!
33:06 - you'd wrap fetchNextUser in a useCallback if you wanted to satisfy the linter and pass fetchNextUser to the dependency array. This is because the function is re-allocated on render because it's within render scope, and therefore the function reference changes between renders, causing your useEffect to every time (based on shallow comparison of the dep array), so useCallback avoids that and keeps the reference the same between renders.
the ref almost hurt my feelings :D
This way of interviewing seems way more relative than just doing algorithms, I wish companies would adopt this.
Yeah, to me watch someone inverting binary tree is so boring haha
In Ukraine most of interviews are like this, close the project/product challenges
frontend interviews are usually less ds-algo
I would leave the interview. If I were applying for a font end position and they started asking my questions beyond the scope of the position I would tell them to have a wonderful day. That is if that is only their concern. If they started out with relative questions and then lead into it just to see the scope of everything I knew... then that would be fine. But I feel most front end specific job interviews do focus more on this style of interviewing. I mean they need to know you can do the front end stuff. Would be funny to hire someone that has mastered sorting algos but then couldn't center a div.
Who ever can solve algorithm questions can solve or learn how to solve these questions and challenges in a minute.
0:50 Make a counter
3:10 Fetch an API
14:10 Display the API data in UI components
22:06 Add a button to load more results
29:38 Bonus: fix the linter's useEffect dependency array requirement
ty
i like the fact that clement is humble and admit that he doesn't know about the error upfront
I'd love to see you guys continue this as a series, gradually increasing the difficulty!
Clément's confidence started to increase once he figured out that the bug was from line 31 instead of 32.
useCallback instead of useRef - it memoizes the fetch function for ref equality, so the effect doesnt rerun on every render. UseCallback will mean that if you eventually do a refactor so the function *does* depend on some value inside the component, your compiler will yell at you until you include it as a dependency. Useref might solve the problem now, but it can hide future potential dependencies. Also, working with a ref is annoying, constantly looking up .current or forgetting to.
If the function used really doesnt depend on anything in the component then it should be externalised if possible.
There's an issue with using useCallback as well. useCallback would depend on all the state variables as well, and since state is changing on each click, useCallback would also return a new function. We'll get the same lint errors like we're getting right now.
@@binaryskeptic5988 The only state I can see is the page number - i.e. only incrementing the page number (stated in the useCallback deps array) should rerun the effect - which if you think about it, is the exact behavior this component is looking for.
In most if not all cases, dependencies may seem annoying at first, but eventually you understand that they declaratively get at exactly the functionality that is needed
@@ShaloopShaloop Makes sense, thank you!
I was looking for this solution.
you could use useMemo as well, by returning the fetch function itself from the hook's callback. useCallback is basically a specialization of useMemo for functions.
Wow, I never knew you could do {name: {first, last}} to convert nested objects into variables, awesome.
Object destructuring
Yes lol, I would have done:
const { name } = userInfo;
const { first, last } = name;
HAHAHAHA
Several tips here:
1. Always add a default value when destructuring nested objects. Like { name: { first, last } = {} }. This will help you to avoid errors if `name` is not defined in base object.
2. You can also rename variables during destructuring to avoid shadows. Like { name: {first: firstName, last: lastName}}
Yea he does a lot of destructuring here, it's confusing at first, but then extremely convenient
Nice
Ben is doing the sassy interviewer stereotype perfectly here.
thank you, that was so nice! as a junior I feel comforted seeing this type of interview, I could actually answer those questions without even typing the code. now it would be really cool to see something like this for junior+, middle, middle+ etc. levels!
I'm a Sr. They didn't ask me to code anything or provide any code. It's the jr roles where they'll want to see it. At a mid and sr level. I think the interviewer can tell because you'll be asking questions about the codebase and the design patterns, issues they have, how they release new features and so on. How many times they're late or delayed, at that time what is going on (are people working weekends and late nights). You're more worried about how the company functions at that point.
fetchNextUser() is a function that gets newly created on every render call since its defined inside the component.
Wrap fetchNextUser() inside the useCallback() hook and mention the dependencies which when changed must create a new fetchNextUser().
It's a bit more efficient this way and I guess that can get rid of the lint error.
^ this to me seems like the best way to handle this
Isn't that pretty much equivalent to putting it in a ref in this case, though?
Great tip!
Should totally do the advanced react interview next
"Uglier the better, this is my jam" nailed it.
i just started learning react few months ago and I am so happy that I understood all the questions and the potential solutions :) Great content!!
Hi Kuldip! Are you open for job change currently? Would you be interested in exploring a job opportunity in web development?
No you didn't
@@computeraidedyami i actuallly did.. It was not because I am smart or anything, I had to learn it for building pcf control in dynamics crm which involves learning react framework. I struggled for weeks until the idea of react components etc clicked in my brain. I still struggle with some of the difficult concepts but overall I undertand things a lot better now.
@@kuldipmaharjan oh ok 👍
so i work for him and he works for you...? i may have to quit
lmaooooo
Looks like a pyramid scheme😂
You should hire Ben and finish the circle
lmaoooo
yea now you hire ben
12:26 we're not gonna catch any errors cuz..... we don't do that here
*CEO MATERIAL SPOTTED*
Can we just appreciate and admire how Clement has nearly 100% accuracy while typing at those speeds
Sorry but not impressive
@@CrazyTVAnime sOrRy bUt NoT ImPrEsSiVe
@@CrazyTVAnime ok boomer
@@CameronCobb sorry but not impressive
@@kylekyle2171 boomer doesnt work here since im 19 and I used to type 170 when I was 13 KEKW
Hey Ben and Clement, nice interview! For your question at 33:11, React encourages you to wrap your fetchRandomData function in useCallback and add it to the dependency array of the useEffect to satisfy the linting 😁 Unfortunately then you'd have to handle the dependency array for the useCallback hook, but it's the "official recommendation". I liked the useRef hack though :) Nice work and entertaining content as always!!
Interview: Why do you want to join this company?
Candidate: I was bullied into doing this interview. lmao
I literally had this interview today... Dude launched right into it with no small talk and went through it at 3x speed. It was rough.
Did you get the job?
Hope you got the job bro
This is really good, I've done interviews in C#, python and on regular stuff but had no idea what it looked like for front end, this is a really approachable React interview to practice with!
I used this to practice for my first React interview - it helped - thanks!
Did you get it?
I wish all interviews Front-End were like this. Relaxing, yet, extensive.
This should be a series !! With a bunch of different languages, and levels of difficulties
Bro i watched your video just like 30 mins before my web development interview and in the react section they have asked the same questions as you have asked and I have solved all those questions thanks to you 😀😀
imagine saying "the uglier the better" to a front end dev😂
Ps- Thanks for the 200 likes
when he said that I was really hoping he would use a
lmaoooo
lol
Well functionality is important if it's working . we can do makeups later.
And the designer 😂
I was dying with laughter when he tried to disable the lint rule with a comment
But we all do that especially for this lint warning 🤣
Yeah this dude is not that good as he says he is
The first thing he did right is the comment but the content is wrong so unable to solve the lint error haha But //eslint-disable-next-line should do it ~
He was at Facebook for 2 months only. Prior to that he was at Google for only 3 years. He has only been programming for 3 years. He learnt how to code 6 months before joining Google. That is why he is not that good.
@@larrydarrell7299 you can be more than good with this much of coding
To solve the eslint message you could:
- Create the fetchNextUser inside the sideEffect so there's no dependency. If it's possible - however, it's been used outside the useEffect.
- Otherwise, use a useCallBack function to memoize the function to avoid re-rendering and re-computing as it's a function.
Just got to the gym, still in the parking lot .. can’t stop watching!! Haha great video
If I ever get have an interviewer like this - I know it’s the kind of person I don’t want to work with. Anyone who watches someone code like that in an interview has a serious superiority complex.
it feels so good to know what they are talking about :)
For the final bit you can pass your setters in the effect, or memo it instead of ref it. But I usually don't have empty dependencies as linting error. Also, I'm almost sure that if you try to set some state while the component already unmounted you'll get a memory leak error on your log, so to go around that you can return early in the promise resolution by setting a flag on a return function of the effect
For that linter error (which I deal with weekly), take that huge function expression out of the component (it's unreadable to define those in there anyways).
Your first thought will be, but now I don't have `setUserInfos` in scope. Right, so pass it as a callback function.
You have one function that fetches data, creates a new merged list, and updates 2 pieces of state. It does too much anyways.
Ok, but now you're thinking that you need to add `setUserInfos` to the dependency list of useEffect, and you're right back to where you started, right?
That's fine, the function that comes back from `useState` is the same exact function on each render. It'll never change.
Consider this snippet from the react docs:
"React guarantees that setState function identity is stable and won’t change on re-renders. This is why it’s safe to omit from the useEffect or useCallback dependency list."
I love these two guys! Two of the most trustworthy coding mentors out there.
damn, even I'm nervous for Clement lmao
Awesome stuff !
what I most liked about this video is the fact that Clément was thinking out loud so we could have a better understanding on how he would solve a problem.
I would love to see a second video.
Thanks guys, from France
PS : René Coty was a french president ;)
I started with react 6 months ago cool to see i was able to answer this stuff. You guys make great videos
So much fun just watching you write React in this context. Nice video! :)
Aside from needing to learn more about pagination, I’d get the job 😂 I wish interviews were like this
00:50
Thank you guys for making this video. I really enjoyed going through these questions & trying to code the solutions to test myself before watching Clément's solutions . Keep making such videos.
I like how Ben Awad puts Clement on the Hot seat... For someone who is an Expert in programming.. It's very mind blowing that still haven't forgotten the basics of programming or should I rather say the fact that they still get excited to do the small tasks... Bigups
This is the greatest crossover of all time
As someone just breaking into the world of programming this was incredibly insightful!
Bruh, Imagine getting a job.
Jobs are overrated, Dante's 7th circle of tutorial hell is where it's at.
this was pretty fun, i'd pause after Ben posted the question and tried to code the solution, the most time I wasted was trying to use fetch correctly, so i'd say just install whichever lib you're most comfortable with
Hi Rohan! Are you open for job change currently? Would you be interested in exploring a job opportunity in web development?
I've got notification of this video from both channels.
Ben, can you interview the Techlead? :D
Ex-millionaire, ex-Google, ex-Facebook, ex-husband, ex-interviewee
This is a joke right?
I like, here take my like 👍👍
Hahahahha
On React Native, as a millionaire?
I've never been so happy in my life, watching coding videos!!! 😄😄😄
This guy could probably speed run building startups
seeing some React stuff ( other than algo ), was really exciting. Also learned a lot. Please try bringing many more stuffs like this. Will be happy to watch :)
Jajaja I've never imagined see those two in a vídeo jajaja
First time I watched this, I was overwhelmed. Now that I know react and typescript, this is definitely a beginner task.
I know this is beginner react interview but it was fun to be able to point out the errors before Clement figured it out.
Made me feel like a genius 😂😂😂😌
This is beginner stuff? How long does it take to get to this point in react?
@@RealNaisuCinema react is like javascript if you know javascript and html you should be able to follow it
@@LuisMorales-yx8di I know the fundamentals of JavaScript and how it works but I can’t make a full project without using stack overflow for help I just know how to do basic things can you look at my portfolio and tell me if you think I’m ready for react?
isaiahflagg.github.io/myPortfolio/
@@LuisMorales-yx8di actually don’t look yet lol I failed to push my code to GitHub last night so my most current projects are not on my portfolio yet lol
@@LuisMorales-yx8di ok you can look at the portfolio now lol
The programming community is so cool and friendly. I wouldn't think of any technical skills other than programming.
Waiting for the next interview... Angular xD
Oh please haha
1st task: Please harvest as many carrots as you can in 30 minutes.
This is interesting, I wish all interviews will be this fun and interactive
This is the most forgiving interview I've seen LOL. Pls be everyone's interviewer Ben!
Honestly, the first line of code Clément wrote is mind-blowing, because I have never seen it done like that anywhere. It's usually React.useState or imported directly from react. well done sir 😂
It's not well done. His code is filled with terrible practices and useless functions. Don't follow this.
Clement when you did map - you forgot to assign key attribute.
Oh the warnings he shall get 😂😂
Technically they aren't required. It's just that React will kill you for that.
For linting error at the end, since you re-defining/assign a new value to your function variable, that is the reason why it changes and always be different.
So to resolve it, use use.memo or use.callback.
Another thing, why using ref stopped the error, since we still assign the value to current?
1. Ref is always stay the same regardless of touching its fields, and changing field doesn't mean changing parent pointer.
2. Useref doesn't cause a re-render. So you can change the current an any point inside render function.
Cheers,
8:23 thats not weird cause you're creating a function using function expression not declaration so it will not be hoisted at the top
Yeah, but I'm calling that function in another function (the React component), so it should never be an issue, as far as I know. I effectively did:
```
function foo() {
bar();
}
const bar = () => {};
```
This _should_ always run properly, and it indeed doesn't get flagged as problematic by the normal TypeScript type checker. Seems like it's the ESLint "no-use-before-define" rule that's a little overly protective.
@@clem yes you're correct
@@clem If I am correct, const and let variables don't get hoisted. Only var and functions do.
@@EDToasty hoisting would matter here if foo would actually be called before bar is declared in Clement example. You would then get a reference error (if bar is declared with const, so only declaration is hoisted without any initialisation, hence the reference error) or a type error (if bar is declared with var, so declaration is hoisted and initialised with "undefined" so it is not yet initialised as a function). Since component is exported, there should be no problems
Great video, love this live coding even though the task isn't that complex, very efficient, and accurate solution :)
I'm surprised that Clement used axios for the API Question and not just fetch with async await.
Right? const result = await (await fetch(url)).json() would have done the job
@@jaggler396 Yep, he definitely made it more complicated then it needed to be.
Axios is far easier than Fetch and does some of the job for you.
This is more handy than a regular React beginner tutorial
finally who took everyone's interview is here for his exam . Now u will understand how it feels 🤣🤣
beautiful......
I'm gonna get to this level soon bro! that feeling of complete confidence in your problem solving skills is the sweetest thing in the world. Excellent work Clément
"I'll put this in a p tag"
"fantastic...!"
i watched this video in january 2021 and i didn't understand a thing... but now again i am here and this time i can solve all questions :)
Hi Anuj! Are you open for job change currently? Would you be interested in exploring a job opportunity in web development?
Clement is such a good sport. Legend! Ben too :)
Coding interviews should be like this. This is how you code in a day to day basis.
At 11:50
You can't use Await directly in UseEffect Callback.
Even you can't type async directly into useEffect Callback for example
useEffect( async ( )=>{
const response = await someApiCall();
} )
You have to create a new function inside the callback of useEffect and then you can use Async Await. For Example
useEffect( ()=>{
async function helloWorld (){
const response = await someApiCall();
}
helloWorld();
})
This is the correct approach.
this video inspired me to learn react before because i couldn't understand it and it looked cool, now it all makes sense lol
Why do you want to work here? I don't, but i have to eat.
the counter task was technically incorrect, should be using the function version of useState. So basically,
onClick = {( ) => setCounter(current => {return current +1})}
Moving from another framework to react I love that I was able to understand all the questions and the solutions and I have learnt more from this video than from many tutorials and courses
Hi Chaitanya! Are you open for job change currently? Would you be interested in exploring a job opportunity in web development?
Best React tutorial format I've seen so far.
Who else had to google half the stuff Clem was typing, even after implementing it on mutiple projects? Sigh.
I have a coding interview today (my first) and while I'm grateful for stumbling upon this video, I have nowhere as much experience as Clem and I am so worried I'll mess it up. Only way is through I suppose.
As a person who has started learning react this gave me a confidence boost since I was able to give right answers
I know this was fun and meant to be funny and light hearted but I had actual anxiety watching this. Even at the begging when he said can you make a button that counts up when I click it, my mind went completely blank and all of a sudden I forgot my my own name. I hate coding interviews.
You need more experience then. If you've done this 1000 times you shouldn't blank out.
The best thing about this video is that someone that is a genius does the same thing we all do, and this was a beginner level test.
WAIT!!!! Clement didn't promote AlgoExpert here, he ain't Clement 😂😂😂😂😂
I learned more off React than i ever wanted to in my life!!!
It was funny with the fetchRandomData moving it up. I have that so ingrained with writing C and pascal that when it isn’t prototypes it goes up. And I did a Java spring project, and the Java guys all put it below and they were frustrated that they had to scroll up on my code :) I said: “that’s how real programmer do it.” :)
I think it’s because he used const instead of function keyword, otherwise it would still work because the variable would be hoisted
@@DaviAreiasa function is const per definition. You can't change a function after all... Well you can in assembly it's called self modifying code but that's a different story. const nameless (lambda) function or named function is a constant
the perks of being a wallflower
Nice movie though.
This was so great. Love your videos, they’re really helping give me more confidence. One side note, never use index on as a key unless the list is immutable. Also, your fetch function was a const, so I’m not sure how the reference would be reassigned.
the real achievement was coding in that font
Which font is that?
@@nasratt yes
that theme and font looks rly good
dank mono
This is legit! I would go as far as to say it’s much more realistic for the majority of developers. Ugly but works, use the internet to cheat, print data just to see what happens, etc. thanks for both for giving this a shot.
Am I the only one to get Clement's algo expert ad with his girlfriend on Ben's videos lol
I wish everyone allow googling stuff in tech interviews😂
Awesome interview! One thing I'd point out is, when you map over userInfos, you shouldn't use the idx as a key, React keys need to be unique to each item, not assigned on the spot
He also said it’s ‘semantic react’ - it’s more than that - react renderer needs that unique key.
this was amazing. Loved that it was frontend ( I never get that in my life anymore)
if these aren't my react interview question tomorrow I'm coming for you.
How was it?