import React from 'react' function Toast(props) { const [display, on] = React.useState(true) function off() { return on(false) } React.useEffect(() => { if (props.timeout) { const to = setTimeout(off, props.timeout) return () => clearTimeout(to) } }, [props.timeout]) return (