Showing posts with label Context. Show all posts
Showing posts with label Context. Show all posts

Friday, April 13, 2018

Context in React 16.3

Context in React in a feature which helps us pass data through the component tree without having to pass them as props through each level of sub-component. Without context the only way to pass a set of values through a component tree is to pass them as props to each level of child component.

This might get complex when we want to share a few global values to many of the sub-components in the component tree. For example data like language preference or style preference which should be re-used by most of the components should be easier to share across various components.