Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

Bumps [json5]( from 1.0.1 to 1.0.2.
- [Release notes](
- [Changelog](
- [Commits](json5/json5@v1.0.1...v1.0.2)

- dependency-name: json5
  dependency-type: indirect

Signed-off-by: dependabot[bot] <>

Signed-off-by: dependabot[bot] <>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]>

Git stats


Failed to load latest commit information.

use-modal-hook ❀️

PRs welcome npm package npm downloads Maintenance

React hook for controlling modal components


#With npm
npm install use-modal-hook --save 
#With yarn
yarn add use-modal-hook


Edit react use modal hook example

import React, { memo } from "react";
import { useModal, ModalProvider } from "use-modal-hook";
import Modal from "react-modal"; // It can be any modal

const MyModal = memo(
  ({ isOpen, onClose, title, description, closeBtnLabel }) => (
    <Modal isOpen={isOpen} onRequestClose={onClose}>
      <button onClick={onClose}>{closeBtnLabel}</button>

const SomePage = memo(() => {
  const [showModal, hideModal] = useModal(MyModal, {
    title: "My Test Modal",
    description: "I Like React Hooks",
    closeBtnLabel: "Close"

  return (
      <h1>Test Page</h1>
      <button onClick={showModal}>Show Modal</button>

const App = () => (
    <SomePage />

useModal(<ModalComponent: Function|>, <modalProps: Object>, <onClose: Function>): [showModal: Function, hideModal: Function]

Param Type Description
ModalComponent Function It can be any react component that you want to use for show modal
modalProps Object Props that you want to pass to your modal component
showModal Function It is function for show your modal, you can pass any dynamic props to this function
hideModal Function It is function for hide your modal, you can pass any dynamic props to this function
onClose Function It callback will be triggered after modal window closes

showModal(dynamicModalProps: Object)

Param Type Description
dynamicModalProps Object Dynamic props that you want to pass to your modal component


MIT Β© alexanderkhivrych