paint-brush
[React] Using Context is easy (30s read)by@peterchang_82818
763 reads
763 reads

[React] Using Context is easy (30s read)

by August 23rd, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Why would you use a context rather than explicitly passing properties down to child elements?

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - [React] Using Context is easy (30s read)
 HackerNoon profile picture

Why would you use a context rather than explicitly passing properties down to child elements?

By using contexts you don’t have to explicitly pass around a whole bunch of props to pass some contextual data.

In brief, a context is an object that is implicitly passed from a component to its children (by José Magalhães).

Clone the example from git :

Reference:

https://facebook.github.io/react/docs/context.html

https://github.com/wahengchang/react-must-know/blob/master/context/index.html