Switch to new context API
See original GitHub issueReact will soon introduce a new API for context. We should start using the latest version of react-broadcast
, which is a polyfill of that API. When we first built styled-components we inlined an implementation of react-broadcast
to avoid introducing an unnecessary layer of components, so that needs to be removed too.
PRs very welcome! 💯
/cc @gaearon
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:19 (13 by maintainers)
Top Results From Across the Web
Context API in React! | Switch to it NOW! - DEV Community ...
This post covers how you can use the Context API in React. ... Create and export another variable/component called MainProvider , where we ......
Read more >Migrating to React's New Context API - Kent C. Dodds
Because of this significant change, I'm making an update to my advanced component patterns course on egghead.io to use the new API rather ......
Read more >Context - React
Context provides a way to pass data through the component tree without having to pass props down manually at every level. In a...
Read more >Get to Know React's New Context API - DigitalOcean
In this tutorial we will demonstrate using React's Context API to handle passing state between many layers of components.
Read more >From Redux to the Context API: A Practical Migration Guide
Let's migrate a React application built with Redux to the Context API and see how it looks like.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FWIW I’m not confident that would work great because
react-broadcast
will be more heavyweight at runtime than the new context API, and in case ofstyled-components
that overhead is shared by every component.Maybe it would be better to cut a new major with 16.3+ compatibility.
There’s also ready to go polyfill create-react-context