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... - Наука
You can download the project source code from here: pezeshkzade.com/blog/source-code/
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!!!!
This is really helpful and concise. Been trying to figure this out for a while to no end. Thank you.
this is pure gold, thank a lot! spent 2 days all over internet without success.
Thanks a lot for this video. I nearly spend an hour to find this exact video I need to solve my problem.
I did a lot of research about this but this video made it clear. Thank you!
This explained easily, what, for some reason, took me way too long to get. THANK YOU!
Wow, super clear, I was reading articles about this but your video was the answer I needed, great one, new sub
This helps explain a lot of what looked like magic to me initially. Thanks.
Beautiful, this helped me learn how to pass information for a modal. I simply can't thank you enough :)
Man, you saved my sanity. Love from Austria. Thank you very much!
Great to hear!
Thank you so much Masoud!
I was struggling so much trying to exchage data between siblings and your video helped a lot !
React is just ❤. Thanks for the explanation.
Thank you, Masoud. You are the legend.
6 hours trying to do it, then your 6-minute video saved my life
Glad I could help!
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.
Glad it helped!
wow, this is a pretty awesome example demonstrsting pass data from component to sibling component, good job !!!
Glad you liked it!
That is exactly what I needed :D Thank you a lot!
Thank you, this was very useful! It helped me achieve what I needed 🙂
Man, you're a life saver! Thank you!
Glad to hear it!
Just what I needed, thanks!
Thanks buddy, You absolutely deserve sub. I am your huge fan. It is gonna award me some bonus from my client.
Awesome, thank you!
Thank you so much for this. Extremely helpful.
You're very welcome!
Man you are just awesome awesome 100x awesome dude.. subscribed for life XD.
Edit - you the best! God bless ya and your family! XDXD
So well explained. made it seem so simple.
holly. thank you so so much. you helped a beginner like me. thank you, got my subcribe
Thank you so much! Saved my life
excellent explanation ! Thank you
you saved my day and nerves
very useful and simple. thanks a lot
very helpful!!! thanks a lot!
Thanks, this was super helpful ❤️
Thanks a lot , this really helped.
Thank you it help me a lot in understanding userState passing
Jazakallahu Khair it is sooo useful
Thank you much Bro!
Thank you! it helped me :)
Extremely super logic.
Just keep it up bro 😘😘😘👌👌
nice, saved my day
Great video!
Wonderful man!!Keep these vids coming. I am smashing the SUBSCRIBE button, you deserve it :)
Much appreciated!
Thanls man, this help me a lot!
You're welcome
it's really helpful thanks a lot for this simple explanation
Glad it was helpful!
thank you veryyy much!!
Thank you!!
Very helpful.
thanks, dude
How would I pass props to the home component?
Thank you :) keep it up
Interesting use case
thank you so much
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?
Helpful video..
good idea
very thanks Masoud
thanks big boss
Thank you keep it up
If animate is not there... Then when can we give... selectedMode?
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?
It is better to use redux and always try to keep your state in the component that you want to be re-rendered!
superb
Thanks
thanks
Well explained/
Nice
I want to know how the animation works
thank you thank you thank you
Any time
thank u so much
You are most welcome
Not working it says 'setSelectedCat' is not defined
link not working
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 .
Yes, for typescript some additional work is required but the concept is the same.
whats the fix for the 2nd one pls i need
how come you didn't push this project to github for people to download and learn ???
Since it was really simple. If you need it I can push it now
@@ReactWithMasoud yeah, that would be great, please push it to github, thank you very much !
@@maskman4821 Sure, I will
Source code added.
@@ReactWithMasoud thanks a lot, man !!!
Thanks
thanks