import * as React from "react"; import {observer} from "mobx-react"; import {UiStore, Message as UiMessage} from "../ui"; import {Message} from "semantic-ui-react"; @observer export default class MessagesView extends React.PureComponent<{ uiStore: UiStore }, void> { render() { return
{this.props.uiStore.messages.map(this.renderMessage)}
; } private renderMessage = (message: UiMessage, index: number) => { const {header, content, type} = message; return this.dismiss(index)}/>; } private dismiss(index: number) { this.props.uiStore.messages.splice(index, 1); } }