Detecting Nested Components in React with the Context API

from blog Aleksandr Hovhannisyan, | ↗ original
Normally, React's Context API is used to avoid prop drilling. But you can also use it to detect if a component is a child of a particular component.