WithNotices Edit

Usage

import { withNotices, Button } from '@wordpress/components';

const MyComponentWithNotices = withNotices(
    ( { noticeOperations, noticeUI } ) => {
        const addError = () => noticeOperations.createErrorNotice( 'Error message' );
        return (
            <div>
                { noticeUI }
                <Button isDefault onClick={ addError }>Add error</Button>
            </div>
        )
    }
);