
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
mui-modal-provider
Advanced tools
[](https://www.npmjs.com/package/mui-modal-provider) [](https://www.npmjs.
npm install mui-modal-provider # or yarn add mui-modal-provider
App.js
import React from 'react';
import ModalProvider, { useModal } from 'mui-modal-provider';
import Blog from './components/Blog';
export default function App() {
return (
<ModalProvider>
<Blog>
</ModalProvider>
)
}
components/Blog.js
import React from 'react';
import Button from '@material-ui/core/Button';
import { useModal } from 'mui-modal-provider';
import HelloWorldDialog from './HelloWorldDialog.js';
export default function Blog() {
const { showModal } = useModal();
const handleClick = () => {
const modal = showModal(HelloWorldDialog, {
title: 'Hello World',
description: 'description text',
onConfirm: () => {
console.log('ok');
modal.hide();
},
onCancel: () => {
console.log('cancel');
modal.hide();
}
});
};
return (
<div>
<Button
variant="contained"
onClick={handleClick}
color="primary"
>
show modal
</Button>
<div>
)
}
components/HelloWorldDialog.js
import React from 'react';
import DialogTitle from '@material-ui/core/DialogTitle';
import DialogContent from '@material-ui/core/DialogContent';
import DialogContentText from '@material-ui/core/DialogContentText';
import Dialog from '@material-ui/core/Dialog';
import Button from '@material-ui/core/Button';
export default function HelloWorldDialog({
title = '',
description = '',
onCancel,
onConfirm,
...props
}) {
return (
<Dialog {...props}>
<DialogTitle>{title}</DialogTitle>
<DialogContent>
<DialogContentText>{description}</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={onCancel} color="primary">
Cancel
</Button>
<Button onClick={onConfirm} color="primary">
Ok
</Button>
</DialogActions>
</Dialog>
);
}
FAQs
[](https://codecov.io/gh/Quernest/mui-modal-provider) [](h
The npm package mui-modal-provider receives a total of 16,486 weekly downloads. As such, mui-modal-provider popularity was classified as popular.
We found that mui-modal-provider demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.