Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asphalt-react/context

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asphalt-react/context

share context among asphalt components

  • 2.0.0-alpha.3
  • npm
  • Socket score

Version published
Weekly downloads
209
decreased by-72.43%
Maintainers
3
Weekly downloads
 
Created
Source

@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>
))

Keywords

FAQs

Package last updated on 19 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc