Components

withNotice

<withNotice />

Constructor

# <withNotice />

Higher 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 'adminjs/core'

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 adminjs/src/frontend/hoc/with-notice.ts, line 31

Type Definitions

object

# AddNoticeProps

Additional props which are passed to your component
Properties:
Name Type Description
addNotice function

View Source adminjs/src/frontend/hoc/with-notice.ts, line 44

object

# NoticeMessage

NoticeMessage which can be presented as a "Toast" message.
Properties:
Name Type Attributes Description
message string
type 'success' | 'error' <optional>

View Source adminjs/src/frontend/hoc/with-notice.ts, line 36