Play with time

This commit is contained in:
Steve Kinney
2024-10-02 16:26:35 -05:00
parent 8fb10ac976
commit a9e36ee3c8
6 changed files with 69 additions and 15 deletions

View File

@@ -1,7 +1,10 @@
import { useState } from 'react';
export const AlertButton = ({}) => {
const [message, setMessage] = useState('Alert!');
export const AlertButton = ({
onSubmit = () => {},
defaultMessage = 'Alert!',
}) => {
const [message, setMessage] = useState(defaultMessage);
return (
<div>
@@ -14,7 +17,7 @@ export const AlertButton = ({}) => {
/>
</label>
<button onClick={() => alert(message)}>Trigger Alert</button>
<button onClick={() => onSubmit(message)}>Trigger Alert</button>
</div>
);
};