Components

withNotice

<withNotice />

Constructor

# <withNotice />

High Order Component which allows you to post notice messages from your components

It gives you the additional prop: addNotice(noticeMessage) taking NoticeMessage.

import { withNotice } from 'admin-bro'

const MY_MESSAGE = {
  message: 'I am toast message',
  type: 'success',
}
const MyCustomComponent = ({ addNotice }) => {
  return (
    <a onClick={() => addNotice(MY_MESSAGE)}>Click Me</a>
  )
}
export default withNotice(MyCustomComponent)

View Source admin-bro/src/frontend/store/with-notice.ts, line 29

Type Definitions

object

# AddNoticeProps

Additional props which are passed to your component

Properties:
Name Type Description
addNotice function

View Source admin-bro/src/frontend/store/with-notice.ts, line 42

object

# NoticeMessage

NoticeMessage which can be presented as a "Toast" message.

Properties:
Name Type Attributes Description
message string
type 'success' | 'error' <optional>

View Source admin-bro/src/frontend/store/with-notice.ts, line 34