1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-06-15 13:36:35 +02:00
Files
foris-js/src/bootstrap/Alert.md
2020-06-04 22:52:24 +02:00

472 B

Bootstrap alert component.

import {useState} from 'react';

function AlertExample(){
    const [alert, setAlert] = useState(true);
    if (alert)
        return <Alert 
            type='warning' 
            onDismiss={()=>setAlert(false)}
        >
            Some warning out there!        
        </Alert>;
    return <button 
        className='btn btn-secondary' 
        onClick={()=>setAlert(true)}
    >Show alert again</button>;
};
<AlertExample/>