
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@kakekomu/react-modal
Advanced tools
A simple React hook for modals.
It is common practice, to use boolean flags like isOpen to decide whether the modal is displayed or not.
Also, the data of the modal might come from a global state. However, when juggling with many modals, this can be a confusing, and can cause errors, like displaying multiple modals at the same time.
This package uses a key for every modal to switch between them. With a openModal function, you can open a modal, and pass it props.
I recommend to hook it up only once, in your root level component, so there is one source of truth for the realm of modals.
import { useModal } from "@kakekomu/react-modal"
const App = () => {
const [activeModal, modalHandlers] = useModal({
myModal: Modal,
})
return (
<div>
{activeModal}
<h1>React Modal example</h1>
<a href="index.tsx">Source code</a>
<button
onClick={() =>
modalHandlers.toggleModal("myModal", {
message: "This custom message is passed as a prop.",
onClose: modalHandlers.closeModal,
})
}
>
Toggle Modal
</button>
<button
onClick={() =>
modalHandlers.openModal("myModal", {
message: "The message can be different.",
onClose: modalHandlers.closeModal,
})
}
>
Open Modal
</button>
</div>
)
}
interface Props {
message: string
onClose: () => void
}
const Modal: React.FunctionComponent<Props> = ({ message, onClose }) => (
<div
style={{
position: "fixed",
left: "50%",
padding: "10px",
border: "1px solid gray",
width: "300px",
height: "200px",
}}
>
<h1>This is a Modal</h1>
<p>{message}</p>
<button onClick={onClose}>Close</button>
</div>
)
FAQs
React-Modal hook
We found that @kakekomu/react-modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.