React Challenge - Can you Build a Multi-Select State Dropdown?

Поділитися
Вставка
  • Опубліковано 8 лис 2024

КОМЕНТАРІ • 44

  • @exmarinplorer
    @exmarinplorer Рік тому +25

    This is a great series of videos, not only you are showing how to build something, but a thought proccess, which I think it`s lacking from most of the coding videos out there! Keep up the good work and thank you!

    • @ryanwoods3333
      @ryanwoods3333 Рік тому +1

      totally agree about how he shows his thought process too.

  • @sumanthprabhu11
    @sumanthprabhu11 Рік тому +13

    This was beautiful.
    Please keep doing these Interview challenges as this really helps to grasp react logic for beginners
    Thank you.

  • @Callumkloos
    @Callumkloos Рік тому +4

    I find the non-scripted nature of these videos really great. Its so useful to hear someone go through a thought process when approaching these problems. Thanks!

  • @aaronhawkins3722
    @aaronhawkins3722 Рік тому +1

    Thanks for sharing your thought processes and taking the time for this video.

  • @rumonintokyo
    @rumonintokyo Рік тому +2

    never thought about using the reduce method to create boolean value objects before. Thank you! Learned something new for sure.

  • @thequang9234
    @thequang9234 Рік тому +1

    please do more of this i'm so very much enjoying this, really solidifies react knowledge !

  • @SoreBrain
    @SoreBrain Рік тому +2

    Please never stop this kind of videos

  • @huge_letters
    @huge_letters Рік тому +2

    I think you could do highlighting without the use of controlled inputs with just pure css - using something like fieldset:has(input:checked), not sure this is the exact selector but something like this.
    But then to count the amount of selected items we could wrap this whole thing in a form and make the form controlled(not really since it doesn't have a value which we set with our state), but keep the inputs uncontrolled - and then use new FormData(e.target) in our form onChange event.
    Also I've noticed this with your previous video as well - for using an object/array etc in a state I think useReducer is a more convenient solution. useState uses it under the hood anyway.
    You could even use Immer lib to mutate the state directly in your reducer for a more concise code but that's optional.
    This is just the stuff I think I would've done differently, I'm not criticizing.

  • @enderclk
    @enderclk Рік тому +2

    Thanks for the great video. Is there any chance to make a React Roadmap video ?

  • @michaelm8044
    @michaelm8044 Рік тому

    Awesome video! I think you did a great job explaining things!

  • @rotembs
    @rotembs Рік тому

    Awesome MultiSelect, I just built one for my company not so long ago, would be nice if you created it as a generic multi select instead of a specific array implementation, would be great if you could make an extended video of the current one, thanks.

  • @poloiaish6281
    @poloiaish6281 Рік тому

    Hey, what tool do you use that when you drag your mouse it shows how many pixels? Awesome video btw. I hope yoy make more react challenges. Keep it up

  • @yjyou7780
    @yjyou7780 Рік тому

    Love this video! Thank you!

  • @alfonsoalejandroespinosade1728

    giga checkbox is the best haha thanks a lot for the video

  • @tony77773
    @tony77773 Рік тому

    hi, can i ask how to create 2 select boxes A and B that can be related and affected like when i make selection 1 in the A box, there will shown (a and b ) options in B box, but when i choose selection 2 in the A box, there will only show ( c and d ) in B box

  • @dahomyhafiz
    @dahomyhafiz Рік тому

    I love these challenges ❤️ so much

  • @thenoxz2924
    @thenoxz2924 Рік тому

    I watch your videos all the time I don`t know why I wasn`t subscribed yet, just fixed that.

    • @WebDevCody
      @WebDevCody  Рік тому +1

      Fix your priorities mate! Thanks for the sub

    • @thenoxz2924
      @thenoxz2924 Рік тому

      @@WebDevCody Thank you for the problem solving videos, makes me want to get into web development, seems pretty interesting.

  • @strahinja2977
    @strahinja2977 Рік тому

    I tried downloading this theme but it looks nothing like yours. Help?

  • @strahinja2977
    @strahinja2977 Рік тому

    What theme are you using? I can't find it anywhere.

  • @depanama6281
    @depanama6281 Рік тому

    It is a good video and I have a question about what you do on ligne 7 usestate

  • @Prohduct
    @Prohduct Рік тому

    yo what is that extension called that highlights the code based on rgb values ?!?!

  • @subeg
    @subeg Рік тому

    What are these vscode icon pack called?

  • @notfadeaway6617
    @notfadeaway6617 Рік тому

    just curous. why you use reduce not map? 17:24

  • @owenn0437
    @owenn0437 Рік тому

    pun unintended 😂

    • @WebDevCody
      @WebDevCody  Рік тому

      what was the pun?

    • @owenn0437
      @owenn0437 Рік тому

      state variable and us state. i think ive been doing much js lately

  • @vivianliu5011
    @vivianliu5011 9 місяців тому

    I would suggesting when init Vite project, remove all the styling it comes with. I saw many times you struggled with some issues that caused by the default style Vite has. I love Vite, but clean what ever Vite's default is something I always do at the beginning of my project.

  • @12345678uygfcxdrtghn
    @12345678uygfcxdrtghn Рік тому +1

    Nice video. I am a newbie, and for the 'click outside', I just create a tinted empty div as a wrapper, that is behind my point of interest, and I put an onclick event to that... Is this practice correct?

    • @WebDevCody
      @WebDevCody  Рік тому +1

      I think a listener on the document is more “proper”. I’d probably go look at how existing click outside libraries work

  • @TheSourLemonz
    @TheSourLemonz Рік тому

    Another good one. But make another dungeon crawl video or we unsub

  • @SeibertSwirl
    @SeibertSwirl Рік тому

    Good job babe!!! First!!!! Love ya!

  • @habesha_ethio
    @habesha_ethio Рік тому

    wawwwwwwwwwwwwwwwww bro thank u

  • @VindexTOS
    @VindexTOS Рік тому

    my solution const [statesArr, setStatesArr] = useState([])
    const stateFiller = (
    e: React.ChangeEvent,
    index: number,
    ) => {
    let value = e.target.value
    let newval = statesArr[index]
    if (e.target.checked) {
    setStatesArr([...statesArr, value])
    } else {
    setStatesArr(statesArr.filter((item) => item !== value))
    }
    }
    const DropDownMenu = () => {
    return (

    {state.map((val: string, index: number) => (

    {val}
    stateFiller(e, index)}
    type="checkbox"
    value={val}
    key={val}
    >

    ))}