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

@fluentui/react-portal-compat-context

Package Overview
Dependencies
Maintainers
0
Versions
604
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluentui/react-portal-compat-context

A package that holds React context for compatibility of React Contexts

  • 9.0.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
123K
decreased by-0.09%
Maintainers
0
Weekly downloads
 
Created
Source

@fluentui/react-portal-compat-context

This package contains the React Context for compat layer in @fluentui/react-portal-compat.

Installation

yarn add @fluentui/react-portal-compat-context

Usage

Note: These APIs are intended to be used by library developers, please use @fluentui/react-portal-compat if you need Portal compatibility.

PortalCompatContextProvider and usePortalCompat() are exported APIs for implementing compat layer.

import { PortalCompatContextProvider, usePortalCompat } from '@fluentui/react-portal-compat-context';

function Consumer() {
  const registerEl = usePortalCompat();

  React.useEffect(() => {
    const portalEl = document.createElement('div');

    return registerEl(portalEl);
  }, [registerEl]);

  return null;
}

function App() {
  const registerEl = React.useCallback((portalEl: HTMLElement) => {
    // do something...
    console.log(portalEl);

    return () => {
      // do something for cleanups...
    };
  }, []);

  return (
    <PortalCompatContextProvider value={registerEl}>
      <Consumer />
    </PortalCompatContextProvider>
  );
}

FAQs

Package last updated on 11 Nov 2024

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