Compound Components in React Using the Context API

Compound components in React allow you to create components with some form of connected state that’s managed amongst themselves. A good example is the Form component in Semantic UI React.
To see how we can implement compound components in a real-life React application, we’ll build a compound (multi-part) form for login and sign up. The state will be saved in the form component and we’ll put React’s Context AP to use to pass that state and the method from …
The post Compound Components in React Using the Context API appeared first on CSS-Tricks.

Link: https://css-tricks.com/compound-components-in-react-using-the-context-api/