I am trying to follow the custom snackbar example in the docs: https://iamhosseindhv.com/notistack/demos#custom-snackbar.
When I try and use the SnackbarContent component that is exposed by notistack, I get the following error in TypeScript:
'SnackbarContent' only refers to a type, but is being used as a value here.
SnackbarContent should of type JSX.Element
Gives the TypeScript error: 'SnackbarContent' only refers to a type, but is being used as a value here.
Trying to create a custom snackbar by using SnackbarContent as the root component (like in the example in the docs).
| Tech | Version |
|--------------|---------|
| Notistack | v1.0.0 |
| React | v16.9.0 |
| TypeScript | v3.7.2 |
I have the same issue.
I am trying to follow the custom snackbar example in the docs: https://iamhosseindhv.com/notistack/demos#custom-snackbar.
When I try and use theSnackbarContentcomponent that is exposed by notistack, I get the following error in TypeScript:
'SnackbarContent' only refers to a type, but is being used as a value here.
Could you make some working domo to reproduce this issue? This code works for me.
const snackbar=useSnackbar();
.....
snackbar.enqueueSnackbar('some message',{
variant: 'default',
content: (key: string | number) => (
<SidebarBanner
id={key}
header={header}
message={message}
/>
),
});
Fixed in #319 . Fix will be published soon.
I'm still experiencing this using "notistack": "^1.0.2".
import { useSnackbar, SnackbarContent } from 'notistack'; --> Module '"../../../../../node_modules/notistack/dist"' has no exported member 'SnackbarContent'.
Most helpful comment
Fixed in #319 . Fix will be published soon.