Here is a more challenging react interview exercise

Поделиться
HTML-код
  • Опубликовано: 14 ноя 2022
  • 💬 Discord / discord
    🔔 Newsletter eepurl.com/hnderP
    📁. GitHub github.com/codyseibert
    My VSCode Extensions:
    - theme: material community high contrast
    - fonts: Menlo, Monaco, 'Courier New', monospace
    - errors: Error Lens
    - extra git help: Git Lens
    - tailwind css intellisense
    - indent rainbow
    - material icon theme
    - prettier & eslint
    - ES7+ React Snippets

Комментарии • 87

  • @McProski
    @McProski Год назад +37

    The Interview questions are legit such solid content. This stuff is invaluable to someone like myself trying to prepare for interviews, I think i have a really solid foundation but I get super super nervous when it comes to technical live coding questions. It's nice to have this to mentally prepare.

    • @anasazkoul4899
      @anasazkoul4899 Год назад +2

      I'm in the same position as you, I think I have a solid foundation but the thing that I'm wondering about is that would this be a question for junior position in React cuz this was not easy to be honest.

    • @ky3ow
      @ky3ow Год назад +3

      ​@@anasazkoul4899 i can share my expirience with interview for react trainee position(i had no commercial experience so not even junior)
      first task was for week in advance, not live coding, just make app like pokedex which fetches pokemons from api, populates grid with them, has button load more which fetches more, and things like filter by pokemon element and show big card of pokemon when you click on it
      in actual interview there were many theoretical questions about html css js and only a bit of react, live coding was to stop child component(that had props being passed from parent) from rerendering extra times (simple solution to wrap component in React.memo)
      and extra question how to deal with same problem but if prop is array or object (wrap them into useMemo)

    • @anasazkoul4899
      @anasazkoul4899 Год назад

      @@ky3ow wow thank you so much for sharing, it's really informative. I think I still need a bit of extra practice with memo, useMemo and useCallback but not really stressed about it that much. and Are you working as a Developer now? do you feel like you gained more experience?

    • @ky3ow
      @ky3ow Год назад +2

      @@anasazkoul4899 yeah its my first month as employed developer(its 3 month probation but i get paid so its like i'm just trainee). About feeling gaining experience, 1. its my first time communicating with backend so much, so i look into devtools network tab alot, not only checking what comes from back but also what payload i send 2. project is large, components are sometimes large, so i got used to utilize vscode ctrl+P shortcut(to navigate between files that can just be in totally different folders, or if i need to find where function is Declared i type @functionName in this prompt) 3. i've not really written very new code, but i refactored few very big class components into nicely organised smaller functional components, that felt like getting experience

    • @anasazkoul4899
      @anasazkoul4899 Год назад +1

      @@ky3ow that sounds absolutely great I hope I can get my foot in the door the way you did. Now I'm planning to make my e-commerce full stack project and post it on my portfolio and it will be the first big project I will ever do by myself. I hope this will get employers' attention. The best of luck with your journey :D

  • @omarmagdy1075
    @omarmagdy1075 Год назад +1

    Recent subscriber very nice content and to the point for any one starting his React journey. Trying these exercises and then see how you tackle the same problem from the perspective of a senior dev is always interesting to watch. Haven't watched the video yet, but sure I will learn something new.

  • @hynekss8618
    @hynekss8618 Год назад +2

    Top notch quality as always! I just can't shake the thought that it could be notably simplified by storing the "grid" values in a single array and letting CSS handle the actual grid.

  • @johndevnoza4223
    @johndevnoza4223 5 месяцев назад +1

    O man your channel both stresses me out and makes me feel good at the same time, since i do improve by watching every video of yours. Even often i dont get some parts but still its very entertaining to watch you solving problems and explaining in a simple way. Like you would talk to your friend. Thanks

  • @BigKaTrob
    @BigKaTrob Год назад

    I enjoy watching your process! I recently had a React interview where the technical question was to create a street traffic controller that cycles through 6 phases of lights (north/south goes from green/yellow/red, then east/west does the same, repeat). It was pretty fun! I'm sure you could have aced it. Thanks for the upload.

    • @WebDevCody
      @WebDevCody  Год назад

      That’s a cool idea I may do that one if I understand what you mean

  • @meraatmostafavi7758
    @meraatmostafavi7758 Год назад

    I really appreciate the live vibe and honesty good job bro

  • @anasazkoul4899
    @anasazkoul4899 Год назад

    Thank you so much for this really beneficial content. I need to sit down and do this myself after having watched the video. and I just wanted to say that I'm really amazed with how you can tackle a problem with such relaxed manner and clear thinking.

    • @WebDevCody
      @WebDevCody  Год назад +1

      There is some editing going on in this videos, so don’t think I’m a coding guru 😂 , but yeah these are fun challenges, good to understand how to do yourself

  • @__asm
    @__asm Год назад

    Man thank you! I'm currently a student and i atleast wanted to learn every single language out there atleast the fundamentals before i graduate

  • @matinkahrizi9606
    @matinkahrizi9606 Год назад +1

    omg this is awesome ! the way you explain it and the way you think of problems and how to solve it. I paused at some scenes to push myself to think about it a bit before you make the solution. btw how many years are you working as a developer ? I'm working as a front-end developer for like 3 years now and by watching your videos I realize how much I need to change my perspectives rather than my knowledge of stacks. wrapping up I really enjoy your work thanks for sharing this stuff with us. love from Iran ♥

    • @WebDevCody
      @WebDevCody  Год назад

      I’ve been coding in the industry for maybe 10 years now. Glad you like my videos!

  • @goa213
    @goa213 Год назад

    Love these type of videos 🤩

  • @jitu11
    @jitu11 Год назад

    superb content...!

  • @fen1x591
    @fen1x591 Год назад

    Yes! I so love this kind of content

  • @adamstrojil1904
    @adamstrojil1904 8 месяцев назад

    Not sure if someone mentioned it already, but please don't use onClick listeners on non-interactive elements (divs, spans, ...), use a instead. This greatly improves a11y and UX (e.g. native keyboard-only support)

  • @buraksurumcuoglu8303
    @buraksurumcuoglu8303 Год назад

    Amazing quality content, learning a lot. One thing I would personally ask is more Vue3 content.

  • @tacolegs2833
    @tacolegs2833 Год назад

    I find your github project layout, specifically the repo associated with your youtube code, very interesting! I'm curious as to how to go about setting up something like that.

    • @WebDevCody
      @WebDevCody  Год назад +1

      I just make one repo and put a sub directory for each project

  • @guilhermegirardi
    @guilhermegirardi 7 месяцев назад

    That's beautiful!

  • @ryanquinn1257
    @ryanquinn1257 Год назад

    People mad at the titles should just leave RUclips because that’s how the algorithm works now haha.
    I love this content for learning. Feels more real than random leetcode problems.
    Making it a game makes it 100x better to learn as well.

  • @Ebiko
    @Ebiko Год назад

    And this pseudo code also helps copilot by a lot. :D
    Although it's already very strong.

  • @010timeboy27
    @010timeboy27 Год назад

    I'm always prematurely optimizing 😂

  • @andrewwall2730
    @andrewwall2730 5 месяцев назад

    What you do in thirty minutes, takes me three hours. Geez, I'll never get through an interview challenge like this in time. Great learning experience though, thank you. I think one thing you can do to simplify is just mapping through the grid like so: const clearSelected = () => grid.map(r => r.map(c => false)). Make sense?

  • @Dswyy
    @Dswyy Год назад

    I do not have the memory nor the brain to do this. Thank you for inspiring me to give up

  • @dugannash9109
    @dugannash9109 Год назад

    lol I wish interview projects were this straight-forward

  • @SeibertSwirl
    @SeibertSwirl Год назад

    Good job babe!!!!

  • @VindexTOS
    @VindexTOS Год назад

    I have been trying to come up with a solution for this by myself for the past week and its been hard, is this challenge above the junior developers' ability?

  • @hymndrazill
    @hymndrazill Год назад +1

    I'm not sure tbh, but i think you took it to a whole other level, why haven't you thought of implementing some conditional rendering? 2 set of states, hide/reveal ? Does that make sense? Great one btw, i appreciate your immense efforts!

    • @WebDevCody
      @WebDevCody  Год назад +1

      Not sure exactly what you mean but thanks for watching! I thought i did conditional rendering in this video?

    • @hymndrazill
      @hymndrazill Год назад

      @@WebDevCody I'll try to explain it a bit, hopefully none of us get confused xD
      What i meant is instead of repeating the [] itself, while didn't you simply re render the values, based on the hide/reveal bool states. like a card has 2 sides right? like a flip, but that would change the whole structure i guess

    • @WebDevCody
      @WebDevCody  Год назад +2

      @@hymndrazill ahh yeah idk there are a lot of ways to solve this problem. If I redid this I would have only used a single 1d array to solve this problem. It’s hard to say what solution is the best, as long as you solve the problem you should be ok

    • @hymndrazill
      @hymndrazill Год назад

      @@WebDevCody indeed! Overall thank you, just wanted to share a thought! see ya in the next one, soon enough hopefully haha

  • @Ebiko
    @Ebiko Год назад +8

    Not sure if I'm alone with this.
    But if I have a fixed row or column length, I think using a single array is better than a 2 dimensional one.
    Because for one, you only need one map() call
    And second, you can style it with column grid template and or flex box easy.

    • @WebDevCody
      @WebDevCody  Год назад +1

      I think that would work well, I didn’t think of that

    • @DaviAreias
      @DaviAreias 4 месяца назад

      Thats what they recommend in the react docs, they say to avoid nesting and use flatened objs instead

  • @Jack-ss4re
    @Jack-ss4re Год назад

    Interview questions like that are for Junior Dev ??

  • @davy_jones6574
    @davy_jones6574 Год назад

    can you/anyone make a playlist off all react interview challenges from this channel. it will be very helpful

  • @ky3ow
    @ky3ow Год назад +2

    28:25 if we need DOM to update right after we setRevealedGrid, i think we can wrap it in flushSync, i think its easiest way instead of weird trick with setTimeout on hasWon(probably can achieve same with effects, but can't tell right away)

    • @WebDevCody
      @WebDevCody  Год назад +3

      oh nice thanks for the info. I think I remember reading about that once but I've never used it before. This is probably a good scenario to use it

  • @VKD007
    @VKD007 Год назад

    ill use array of objects for state which will have the key to the other object and another array with the key if objects. ill add the key to they array if the guess was right and boom.

  • @ananthak555
    @ananthak555 Год назад

    Is there a good reason for not using a 1-D array and use flex wrap ?

  • @mprasanth18
    @mprasanth18 Год назад

    In react if we decide to not to specify the key, react by default will use index as the key I think, we don’t need to specify the key if we are going to use index as the key. Correct me if my understanding is wrong.

    • @WebDevCody
      @WebDevCody  Год назад +1

      Yeah that is correct. I just like to explicitly set it

  • @whythisisntchanging
    @whythisisntchanging Год назад

    handleCardClicked() should only update the state and then use useEffect( () => { ..your side effects here }, [previousClick] ); to add any side effects to your state updates :) imo, that would be way cleaner way to do it

    • @WebDevCody
      @WebDevCody  Год назад +2

      Sounds interesting, but I disagree. UseEffect makes the code harder to follow imo.

  • @yousafwazir3167
    @yousafwazir3167 Год назад +3

    Would you ever consider interviewing / talking with other tech people for a video ?

    • @WebDevCody
      @WebDevCody  Год назад +1

      Possibly, as in I’d interview someone?

    • @yousafwazir3167
      @yousafwazir3167 Год назад +1

      @@WebDevCody it could be a interview or a tech discussion something to get people from the tech space to share new ideas, tech or just stuff you’d find interesting.

    • @WebDevCody
      @WebDevCody  Год назад

      @@yousafwazir3167 oh, maybe one day. I do plan to do a collab with another youtuber Sunday to learn some new things

  • @larssmeets773
    @larssmeets773 Год назад

    Isn't it like easier to make an array of objects. And with the object the fields are turned, solved and number. So when the number is the same as another number both objects are set to solved and will be out of the array. And when the user clicks on 2 objects both fields turned are true and when its both wrong they both will go to turned: false again.

    • @WebDevCody
      @WebDevCody  Год назад

      Easier is subjective, but sure that’ll solve the problem just the same

  • @andrewkosenko2757
    @andrewkosenko2757 9 месяцев назад

    Bro, the closing div should have a slash in it 4:47

  • @ruudlaff10
    @ruudlaff10 Год назад

    Using a 2D Array to contain the data to show rows/columns rather than just using a flat array and CSS Grid with for styling it into a grid seems an odd choice?

  • @ethaneth6481
    @ethaneth6481 8 месяцев назад

    will you do something for seniors?

    • @WebDevCody
      @WebDevCody  8 месяцев назад

      Seniors probably don’t get these type of challenges

  • @alfredcarano-o8073
    @alfredcarano-o8073 Год назад

    WOW

  • @rolandocruz1695
    @rolandocruz1695 Год назад +1

    Watching these even tho i applied to over 500 jobs and none have given me something like this. Its all hard leetcode im applying for front end :(

    • @WebDevCody
      @WebDevCody  Год назад +1

      That sucks, leet code questions are not very practical, but still challenging. I’d rather be quizzed on something practical

  • @avalaavala2267
    @avalaavala2267 Год назад

    Does"t it have a bug when you click fast on everywhere?

  • @zwolof
    @zwolof Год назад +1

    Have you considered doing live interviews like this with random people? "fake job interview"

  • @VivekChavan-ov3pl
    @VivekChavan-ov3pl Год назад

    24:00

  • @yourmamaisphat
    @yourmamaisphat Год назад

    If you have tons of errors, don’t read them, just delete everything and start over. 😂😂😂

    • @WebDevCody
      @WebDevCody  Год назад

      Sometimes it’s easier than reading these aweful error messages

  • @sameerahmedk
    @sameerahmedk 16 часов назад

    Why are all your old videos showing only 360p quality?
    The only other quality option is 1080p Premium (requires RUclips premium).
    Can you look into this? All the code is pixelated making all such old yet timeless videos unwatchable :(

    • @WebDevCody
      @WebDevCody  14 часов назад

      Hmmm I’m not sure I can try to look into it. On my end it says HD

    • @sameerahmedk
      @sameerahmedk 14 часов назад

      It shows "1080p Enhanced Bitrate" (on these React interview playlist atleast) but that's only available for premium users. The only other option usable is 360p. No other available even.
      On recent videos, the standard 1080p is still there

  • @hridoy8021
    @hridoy8021 Год назад

    Dude I like your style of teaching but you really push yourself off-grid and the viewers at times 😑 just slow down a little, we know you're the man here 🙄

  • @coolorphans
    @coolorphans Год назад +1

    Yeah let me waste a year of my life learning about specific function names so I can build some basic UI.

  • @BrianRiendeau
    @BrianRiendeau Год назад

    You need to explain all syntax for beginners. This is nowhere near beginners level. Being so advanced you are out of touch.

    • @user-ls5pg2wd4i
      @user-ls5pg2wd4i Год назад +6

      He never said that the content is meant for junior developers

    • @WebDevCody
      @WebDevCody  Год назад +9

      Yeah this isn’t a challenge for someone who doesn’t even understand JavaScript and react syntax

    • @SeibertSwirl
      @SeibertSwirl Год назад +6

      So rude for no reason

    • @Kay8B
      @Kay8B Год назад +3

      Its literally in the title " *more* challenging", go to his simpler challenges if you need more of a basic challenge/tutorial.