Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'openSnackbar' of null #13

Open
figuibej opened this issue Oct 20, 2020 · 2 comments
Open

Cannot read property 'openSnackbar' of null #13

figuibej opened this issue Oct 20, 2020 · 2 comments

Comments

@figuibej
Copy link

Im facing issues when i want to use the useSnakackbar(), also i have the same issue with 1.1.9

App Sample:
Codebox sample

@josmontes
Copy link

You are using the hook outside of the provider

@palyvodaBoi
Copy link

palyvodaBoi commented Dec 18, 2020

You have to add SnackbarProvider to the upper component (e.g. App.js)

// App.js
import React from 'react'
import SnackbarProvider from 'react-simple-snackbar' // <---------- HERE
import SomeChildComponent from './SomeChildComponent'

export default function App() {
  return (
    <SnackbarProvider>  // <---------- HERE
      <SomeChildComponent />
    </SnackbarProvider> // <---------- HERE
  )
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants