It's fairly common practice to expose callback props in React components. There are several reasons you might use callback props:
- Notifying ancestors of some condition
- Providing a way to render a surface inside your component, the so called render props.
- A special case of render props is where the ancestor provides data that then feeds into what gets rendered.
My example builds on the last use-case. Consider the following hello world component:
interface HelloWorldProps {