🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

react-modal-ctx

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-modal-ctx

Modal control context made to be used with `react-modal` library. This context grans you more control over modals for example:

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

React modal context

Modal control context made to be used with react-modal library. This context grans you more control over modals for example:

  • Close modal on message or event.
  • Open modal instead of currently open modal.
  • Switch between modals.
  • Use modals as carousel.

Table of Contents

  • Installation
  • Documentation

Installation

you can use npm or yarn

$ npm install react-modal-ctx
$ yarn add react-modal-ctx

Documentation

ModalContextProvider

import { ModalContextProvider } from 'react-modal-ctx';

const App = () => (
  <ModalContextProvider>
    <Page />
  </ModalContextProvider>
)

wrapping Page component enables you to use useModalContext in it.

useModalContext

import { useModalContext } from 'react-modal-ctx';

const {
  openModal,
  openNextModal, 
  closeModal,
  clearModals,
} = useModalContext();
MethodDescription
openModalCloses(clears) all other modals and open's new modal.
openNextModalopens new modal but leaves old modals in queue so when this modal will be closed previous modal will be shown.
closeModalcloses top modal
closeAllModalscloses all modals in queue

Keywords

react

FAQs

Package last updated on 23 Jan 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