educative.io

Props are way of passing data from one component to another

“Props are way of passing data from one component to another” how come this statement is true. I feel like the wording is very vague and if I read this statement I would say it is false because props should be coming from the parent component not from a sibling component. So this statement would be false in my opinion. Am I missing something here?

Hey @Caner_Demir

Yes, props are used to pass data from the parent component to a child component, to pass data from the child to parent component we have to create a callback function in the parent component and then pass the callback function to the child component as a prop. In order to pass data between siblings, we can use the following methods:

  • ContextAPI
  • Redux
  • Combo of props and callback function

Happy learning,