Last active
April 12, 2022 22:30
-
-
Save henev/48f7be0f1209129de274f57cafbb1bd2 to your computer and use it in GitHub Desktop.
Toast Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useTimeout } from '../hooks/useTimeout'; | |
export const Toast = (props) => { | |
useTimeout(props.close, 5000); | |
return ( | |
<div className="toast"> | |
<div className="toast__text">{props.children}</div> | |
<div> | |
<button onClick={props.close} className="toast__close-btn"> | |
x | |
</button> | |
</div> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment