React Context in the World of Component Composition

“Context is designed to share data that can be considered “global” for a tree of React components” (React Docs)

The Menu

In our app, Item 2.2.1 is the currently selected subpage. It’s ancestors in the menu are also highlighted.

Giving The Menu Items Some Context

Thinking of Other Use Cases

Conclusion

--

--

--

Frontend Engineer @MarvelApp

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Leetcode #97 Interleaving String (DP)

Get Started With These 3 API Projects

Some Important JavaScript Questions

The State of Neumorphic Design in React Native

The State of Neumorphic Design in React Native

Essential VS Code Extensions For JavaScript Developers

Hands connecting two puzzles

Build an Image Carousel With React Slick

Projector

shopify refund data

React Tutorial — Learn React in 5 hours — Part 2

React class component

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Boris Ablamunits

Boris Ablamunits

Frontend Engineer @MarvelApp

More from Medium

ReactJS — State Management

React: “reduce” method

React Router

Why Use React JS: A Complete Guide | React JS Developer