question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Snackbar] TypeError: _props.toast is undefined when import single component

See original GitHub issue

Description

When importing with

import Snackbar from 'react-md/lib/Snackbars/Snackbar';

browser logs this error and the page doesn’t load (blank)

TypeError: _props.toast is undefined

but this bug isn’t presented if I use

 import { Snackbar } from 'react-md';

then the page loads and snackbar emits toast sucessfully.

Version

  • React - 15.5.4
  • React-MD - 1.3.0
  • Browser Firefox 59.0.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Kaishiyokucommented, May 9, 2018

That worked, thank you.

1reaction
mlaursencommented, May 9, 2018

Please see the documentation notes

The Snackbar component is used for displaying a concise and small message to the user about an operation performed.

The main component for the Snackbar is actually named the SnackbarContainer, so you need to make sure the import is react-md/lib/Snackbars or react-md/lib/Snackbars/SnackbarContainer. The first import is preferable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Unable to use a hook in a component - Stack Overflow
It seems like your snackbar.js is not a component. You can only use hooks inside components. – polcats. Aug 13, 2020 at 1:58....
Read more >
Support for displaying snackbar outside of component #30
Store the enqueueSnackbar & closeSnackbar in the some class variable at the time of startup of the application, And use anywhere in your...
Read more >
notistack - npm
It is highly customizable and enables you to stack snackbars/toasts on top of one another. Visit documentation website for demos.
Read more >
Toasts - React-Bootstrap Documentation
This is a toast message. import Toast from 'react-bootstrap/Toast'; function BasicExample() { return ( <Toast> <Toast.
Read more >
“TypeError: Cannot read property 'open' of undefined”
In my laravel project I'm using a package called LaraToaster https://github.com/theorythree/LaraToaster i do what the package required LaraToaster.vue.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found