#Issue with Notifications and NotificationsProvider

1 messages · Page 1 of 1 (latest)

visual matrix
#

In App.jsx I have

<MantineProvider theme = {theme}>
  <AppShell ...>
    <AppShell.Navbar ...>
      ...
    </AppShell.Navbar ...>
    <AppShell.Main ...>
      ...
    </AppShell.Main ...>
    <AppShell.Footer ...>
      ...
    </AppShell.Footer ...>
  </AppShell ...>
  </MantineProvider>

I want to add a notification that pops up on app load. If I do a standard

import { notifications } from '@mantine/notifications';

then

notifications.show({
  title: 'Notification title',
  message: 'Notification message',
})

inside a useEffect at the start of my app, no notification appears.

I then read online that you should use NotificationsProvider from @mantine/notifications and place that as follows:

<MantineProvider theme={yourTheme}>
      <NotificationsProvider>
        ...
      </NotificationsProvider>
    </MantineProvider>

but on import I get an error:

Uncaught SyntaxError: The requested module '/node_modules/...' does not provide an export named 'NotificationsProvider'

Can anyone help? Thank you! 😊

tall oasis
#

Can you do npm list @mantine/notifications what does it say?