Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const ExampleModal = (props: ExampleModalProps) => {
const { className, show, onOK = noop, onCancel = noop } = props;
// The following is a simple example of how to use React hooks.
const [time, setTime] = React.useState(0);
React.useEffect(() => {
// Reset time.
setTime(0);
}, [show]);
useInterval(() => setTime(prevTime => prevTime + 1), 1000, !show);
return (
<div>
<header>
<h6>Dialog</h6>
</header>
<div>
<div>Press Esc or click the buttons.</div>
<div>
Time Elapsed: <span>{`${time}s`}</span>
</div>
</div>
<div>
<div>
Cancel</div></div></div>
export const ExampleModal = (props: ExampleModalProps) => {
const { className, show, onOK = noop, onCancel = noop } = props;
// The following is a simple example of how to use React hooks.
const [time, setTime] = React.useState(0);
React.useEffect(() => {
// Reset time.
setTime(0);
}, [show]);
useInterval(() => setTime(prevTime => prevTime + 1), 1000, !show);
return (
<div>
<header>
<h6>Dialog</h6>
</header>
<div>
<div>Press Esc or click the buttons.</div>
<div>
Time Elapsed: <span>{`${time}s`}</span></div></div></div>