Context
Context
Note: As of React v15.5 the
React.PropTypes
helper is deprecated, and we recommend using theprop-types
library to definecontextTypes
.
With React, it's easy to track the flow of data through your React components. When you look at a component, you can see which props are being passed, which makes your apps easy to reason about.
In some cases, you want to pass data through the component tree without having to pass the props down manually at every level. You can do this directly in React with the powerful "context" API.
Why Not To Use Context
The vast majority of applications do not need to use context.
If you want your application to be stable, don't use context. It is an experimental API and it is likely to break in future releases of React.
If