2.0.0-rc.4 • Published 9 months ago
@asphalt-react/context v2.0.0-rc.4
@asphalt-react/context
⚠️ Designed for Asphalt React component packages. Use at your own risk, if using externally.
A package which contains a React context
which is to be shared among asphalt components.
Why
There are use cases, where two different packages need to communicate. In such cases, rather than creating inter-package dependency, they both can import @asphalt-react/context
and use Provider
and Consumer
from it.
Usage
Provider
import Component2 from "@asphalt-react/component"
import { Provider } from "@asphalt-react/context"
export default (Component = () => (
<Provider value={{ id: 1 }}>
<Component2 />
</Provider>
))
Consumer
import { Provider } from "@asphalt-react/context"
export default (Component2 = () => (
<Consumer>{({ id }) => <span>{id}</span>}</Consumer>
))
2.0.0-rc.4
9 months ago
2.0.0-rc.0
11 months ago
2.0.0-alpha.28
2 years ago
2.0.0-alpha.16
2 years ago
2.0.0-alpha.13
2 years ago
2.0.0-alpha.8
3 years ago
2.0.0-alpha.4
3 years ago
1.16.0
3 years ago
2.0.0-alpha.7
3 years ago
2.0.0-alpha.3
3 years ago
1.14.1
3 years ago
2.0.0-alpha.2
3 years ago
2.0.0-alpha.1
3 years ago
1.13.0
3 years ago