React passing data between siblings

Поделиться
HTML-код
  • Опубликовано: 21 окт 2020
  • In this tutorial, you will learn how to pass data between siblings components without using any third-party library.
    In React you can pass state as props to the child components but you cannot pass state between sibling components.
    The best solution for this can be wrapping both siblings in a parent component and handle the state inside the parent component. Then you easily can share the state between any siblings that you want and use the state inside the child components.
    Hope you enjoy it!
    You can download the project source code from here: pezeshkzade.com/blog/source-c...
  • НаукаНаука

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

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

    You can download the project source code from here: pezeshkzade.com/blog/source-code/

  • @geezer74
    @geezer74 2 года назад +7

    Oh MY GOD!!!!!! You are incredible!!!!, I have searched days and hours for this to no end!. This has to be the greatest solution ever!!!!

  • @abigailfolarin5876
    @abigailfolarin5876 2 года назад +3

    This is really helpful and concise. Been trying to figure this out for a while to no end. Thank you.

  • @juandiegoalbino6079
    @juandiegoalbino6079 2 года назад

    this is pure gold, thank a lot! spent 2 days all over internet without success.

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

    Thanks a lot for this video. I nearly spend an hour to find this exact video I need to solve my problem.

  • @FromHeavenBaby
    @FromHeavenBaby 3 года назад +1

    I did a lot of research about this but this video made it clear. Thank you!

  • @gabel7323
    @gabel7323 2 года назад

    This explained easily, what, for some reason, took me way too long to get. THANK YOU!

  • @JoaqoCR7
    @JoaqoCR7 3 года назад +1

    Wow, super clear, I was reading articles about this but your video was the answer I needed, great one, new sub

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

    This helps explain a lot of what looked like magic to me initially. Thanks.

  • @chedic8466
    @chedic8466 2 года назад +2

    Beautiful, this helped me learn how to pass information for a modal. I simply can't thank you enough :)

  • @for41
    @for41 2 года назад

    Man, you saved my sanity. Love from Austria. Thank you very much!

  • @michelpomerantzeff1749
    @michelpomerantzeff1749 2 года назад

    Thank you so much Masoud!
    I was struggling so much trying to exchage data between siblings and your video helped a lot !

  • @rishabhsinha3713
    @rishabhsinha3713 3 года назад +1

    React is just ❤. Thanks for the explanation.

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

    Thank you, Masoud. You are the legend.

  • @alejadiaz5
    @alejadiaz5 2 года назад

    6 hours trying to do it, then your 6-minute video saved my life

  • @EugeneVe
    @EugeneVe 2 года назад +1

    Thank you, this really helped me, I've been looking for this solution for a long time. I am new in react, so this is a great tutorial.

  • @maskman4821
    @maskman4821 3 года назад +1

    wow, this is a pretty awesome example demonstrsting pass data from component to sibling component, good job !!!

  • @r_majka
    @r_majka 2 года назад

    That is exactly what I needed :D Thank you a lot!

  • @vlad_dimov
    @vlad_dimov 2 года назад +1

    Thank you, this was very useful! It helped me achieve what I needed 🙂

  • @axeld.santacruz4659
    @axeld.santacruz4659 2 года назад

    Man, you're a life saver! Thank you!

  • @MALIWAL1000
    @MALIWAL1000 2 года назад

    Just what I needed, thanks!

  • @crazeislive_cil
    @crazeislive_cil 3 года назад

    Thanks buddy, You absolutely deserve sub. I am your huge fan. It is gonna award me some bonus from my client.

  • @kreddy241
    @kreddy241 3 года назад +1

    Thank you so much for this. Extremely helpful.

  • @SoraFromIndia
    @SoraFromIndia 2 года назад

    Man you are just awesome awesome 100x awesome dude.. subscribed for life XD.
    Edit - you the best! God bless ya and your family! XDXD

  • @alexbarasa3816
    @alexbarasa3816 2 года назад

    So well explained. made it seem so simple.

  • @quanghopninh3376
    @quanghopninh3376 3 года назад

    holly. thank you so so much. you helped a beginner like me. thank you, got my subcribe

  • @jiazhengliu2137
    @jiazhengliu2137 2 года назад

    Thank you so much! Saved my life

  • @camels_are_sober
    @camels_are_sober 2 года назад

    excellent explanation ! Thank you

  • @TomRadic
    @TomRadic 2 года назад +1

    you saved my day and nerves

  • @cryptoswithpotential181
    @cryptoswithpotential181 2 года назад

    very useful and simple. thanks a lot

  • @alessandrospiridigliozzi7943
    @alessandrospiridigliozzi7943 2 года назад

    very helpful!!! thanks a lot!

  • @milzdechnik846
    @milzdechnik846 3 года назад

    Thanks, this was super helpful ❤️

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

    Thanks a lot , this really helped.

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

    Thank you it help me a lot in understanding userState passing

  • @aminatmoldalieva6385
    @aminatmoldalieva6385 2 года назад

    Jazakallahu Khair it is sooo useful

  • @bhavykhatter6375
    @bhavykhatter6375 2 года назад

    Thank you much Bro!

  • @erwindemata6439
    @erwindemata6439 3 года назад

    Thank you! it helped me :)

  • @subhradeephalder9737
    @subhradeephalder9737 3 года назад

    Extremely super logic.

  • @parimalpatil0709
    @parimalpatil0709 2 года назад

    Just keep it up bro 😘😘😘👌👌

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

    nice, saved my day

  • @amitbt69
    @amitbt69 3 года назад

    Great video!

  • @anikkhan8811
    @anikkhan8811 3 года назад

    Wonderful man!!Keep these vids coming. I am smashing the SUBSCRIBE button, you deserve it :)

  • @lucasgaudio9016
    @lucasgaudio9016 3 года назад

    Thanls man, this help me a lot!

  • @saadeddyneelabdari455
    @saadeddyneelabdari455 3 года назад

    it's really helpful thanks a lot for this simple explanation

  • @nargizgasanova6222
    @nargizgasanova6222 2 года назад

    thank you veryyy much!!

  • @victoria320-49
    @victoria320-49 2 года назад

    Thank you!!

  • @linyerin
    @linyerin 2 года назад

    Very helpful.

  • @imthiyazmuhammed2517
    @imthiyazmuhammed2517 3 года назад

    thanks, dude

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

    How would I pass props to the home component?

  • @anuruddhabandara2071
    @anuruddhabandara2071 3 года назад

    Thank you :) keep it up

  • @chocinspired
    @chocinspired 2 года назад

    Interesting use case

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

    thank you so much

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

    what could I be doing wrong, if it works with the first click but the next time I click the button it doesn't update?

  • @ankitmehrotra8519
    @ankitmehrotra8519 3 года назад

    Helpful video..

  • @ZeyadMohamed-uj5pn
    @ZeyadMohamed-uj5pn 7 месяцев назад

    good idea

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

    very thanks Masoud

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

    thanks big boss

  • @amrad2324
    @amrad2324 2 года назад

    Thank you keep it up

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

    If animate is not there... Then when can we give... selectedMode?

  • @AN-ox7sb
    @AN-ox7sb 3 года назад

    but if I understand correctly, this will cause the app component to render all of its child components, so in this example, the sidebar will render every time app.js state is change, what if I want to render only the home component?

    • @ReactWithMasoud
      @ReactWithMasoud  3 года назад

      It is better to use redux and always try to keep your state in the component that you want to be re-rendered!

  • @gauravyadav2475
    @gauravyadav2475 3 года назад

    superb

  • @MrAmrmnabil
    @MrAmrmnabil 2 года назад

    Thanks

  • @mohammadmahdialvansaz8001
    @mohammadmahdialvansaz8001 2 года назад

    thanks

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

    Well explained/

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

    Nice

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

    I want to know how the animation works

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

    thank you thank you thank you

  • @sabareeshsk1326
    @sabareeshsk1326 2 года назад

    thank u so much

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

    Not working it says 'setSelectedCat' is not defined

  • @aslampathan3066
    @aslampathan3066 2 месяца назад

    link not working

  • @enmanuelruiz544
    @enmanuelruiz544 2 года назад

    This is a really good tutorial, but if you try it in React typeScript, it going to give u some errors.
    1. You'll have to specify the parameters type as any
    2. Pass the function setState is not going to work .

    • @ReactWithMasoud
      @ReactWithMasoud  2 года назад

      Yes, for typescript some additional work is required but the concept is the same.

    • @bobba0385
      @bobba0385 11 месяцев назад

      whats the fix for the 2nd one pls i need

  • @maskman4821
    @maskman4821 3 года назад

    how come you didn't push this project to github for people to download and learn ???

    • @ReactWithMasoud
      @ReactWithMasoud  3 года назад

      Since it was really simple. If you need it I can push it now

    • @maskman4821
      @maskman4821 3 года назад +2

      @@ReactWithMasoud yeah, that would be great, please push it to github, thank you very much !

    • @ReactWithMasoud
      @ReactWithMasoud  3 года назад +1

      @@maskman4821 Sure, I will

    • @ReactWithMasoud
      @ReactWithMasoud  3 года назад +1

      Source code added.

    • @maskman4821
      @maskman4821 3 года назад

      @@ReactWithMasoud thanks a lot, man !!!

  • @random-user-1337
    @random-user-1337 Год назад

    Thanks

  • @alukret
    @alukret 2 года назад

    thanks