Notistack: Cannot read property 'handleEnqueueSnackbar' of undefined

Created on 12 Jul 2019  路  1Comment  路  Source: iamhosseindhv/notistack

i try to use notistack like following. but it given 'Uncaught TypeError: Cannot read property 'handleEnqueueSnackbar' of undefined'

import { SnackbarProvider, useSnackbar } from 'notistack';

const ConfigureRateList = ()=> {
    const { enqueueSnackbar } = useSnackbar();

    // codes... 

    return (
        <SnackbarProvider maxSnack={3}> 
            // codes....
        </SnackbarProvider >
    )
}

Most helpful comment

@sajja94 useSnackbar or withSnackbar should be at least one level down the tree. meaning that they're not accessible in the component where you wrap your app in a SnackbarProvider. and are accessible in the children of that component.

>All comments

@sajja94 useSnackbar or withSnackbar should be at least one level down the tree. meaning that they're not accessible in the component where you wrap your app in a SnackbarProvider. and are accessible in the children of that component.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FabianoLothor picture FabianoLothor  路  4Comments

iamhosseindhv picture iamhosseindhv  路  8Comments

VincentLanglet picture VincentLanglet  路  3Comments

khanhdinovative picture khanhdinovative  路  3Comments

seannguyn picture seannguyn  路  4Comments