I have a modal that is opened by a button click. I want to use it in different places with different types of buttons. I understand I can pass components into the parent, but what about when those components need to trigger the parent’s state?
( of course the modal component above is a stateless component for brevity, but imagine its an es6 class with a state object that has a ‘open boolean’)
Then I could have a modal that is triggered by either a circle button or a square button:
If the child has a prop, then it is because its parent provided that prop to the child! Why do you want the child to pass back the prop to the parent, while the parent obviously already has that prop?