react-simple-snackbar icon indicating copy to clipboard operation
react-simple-snackbar copied to clipboard

Cannot read property 'openSnackbar' of null

Open figuibej opened this issue 5 years ago • 2 comments

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

App Sample: Codebox sample

figuibej avatar Oct 20 '20 23:10 figuibej

You are using the hook outside of the provider

josmontes avatar Oct 28 '20 17:10 josmontes

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
  )
}

palyvodaBoi avatar Dec 18 '20 10:12 palyvodaBoi