I'm using notistack (3.0.1) to handle toasts in my NextJS (14.0.4) project.
I don't understand what's causing the error that shows up when I trigger the enqueueSnackbar-function: "NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node."
I'm using a Provers component within my layout-file, so to wrap the app in the SnackbarProvider-context within a client-component. I've seen this pattern been used before, though I'm not sure what else could cause the issue
const RootLayout = ({ children }: { children: React.ReactNode }) => {
return (
<Providers>
<html lang="no">
<body id="__next" >
{children}
</body>
</html>
</Providers>
)
}
export default RootLayout
"use client"
import { SnackbarProvider } from "notistack"
export const Providers = ({ children }: { children: React.ReactNode }) => {
return (
<SnackbarProvider>
{children}
</SnackbarProvider>
)
}
The issue was caused by the provider being set outside of the html-tag. It was solved by placing Providers within the html-tags like so