18 lines
421 B
JavaScript
18 lines
421 B
JavaScript
|
import React from "react";
|
||
|
|
||
|
export default function MessageBanner({state, dispatch}) {
|
||
|
function handleClose() {
|
||
|
dispatch({
|
||
|
type: 'closed_message_banner'
|
||
|
})
|
||
|
}
|
||
|
|
||
|
if (!!state.errorMessage) {
|
||
|
return (<div className={"message-banner"}>
|
||
|
{state.errorMessage}
|
||
|
<button onClick={handleClose}>Dismiss message</button>
|
||
|
</div>);
|
||
|
}
|
||
|
return <></>;
|
||
|
}
|