Why context? A component tree can quickly grow. The root component has many children, the children have many children and so on. What if you want to pass information that is considered global to a tree or subtree of components? For example what language these components should use. Or what the username is. You could use props of course, but it seems unnessary to pass on the same information over and over again to each component. This is where the context comes in. Pre context In this example from the React website no context is used. The theme with value dark is passed with a prop to the child toolbar component which passes it on to it's child ThemedButton also...
Here are some upcoming public events I'll speak at. If you'd like a private event around one of these topics please contact me
- Code Europe: 22 April, Warsaw, April 26th Wroclaw — Authentication in ASP.NET Core
- Bucharest Technology Week: 20 May, Bucharest — Like a Fish in Water with ASP.NET Core
- Experts Live: 19 June, Ede NL — Top 10 Browser Threats Mitigated
- Developer week: 25 June, Nuremberg — Authentication in ASP.NET Core
- Pluralsight Live: 28 August, Salt Lake City — Understanding Modern Cloud Architecture
Don't have Pluralsight? Apply here to watch my courses below and many others for free!
- A Practical Start with React
- Understanding ASP.NET Core 2.x
- Getting Started with ES2017/ES8
- Scaling Applications with Microservices and NServiceBus 6
- Understanding ASP.NET Core Security
- A Practical Start with TypeScript
- Scaling Applications with Microservices, MassTransit and RabbitMQ
- Scaling Applications with Microservices and NServiceBus 5
- Introduction to Graph Databases and Neo4j
- Creating Mobile Apps: Native, Hybrid or Cross Platform?