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.

Uncaught Error: The element you provided cannot be rendered.

See original GitHub issue

Hi,

I’m having this error after one toast has been shown:

ToastContainer.js:201 Uncaught Error: The element you provided cannot be rendered. You provided an element of type undefined
    at ToastContainer.show (ToastContainer.js:201)
    at Object.<anonymous> (ToastContainer.js:140)
    at EventManager.js:39

In App.js I do this:

componentWillReceiveProps(nextProps) {
    if (nextProps.errorMessage !== '') toast.error(nextProps.errorMessage);
  }

and the render:

render() {
    const { isAuthenticated } = this.props;

    return (
      <Fragment>
        <ToastContainer position="bottom-right" />
        <Geolocation />
        <App isAuthenticated={isAuthenticated} />
      </Fragment>
    );
  }

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
charleskoehlcommented, Sep 24, 2018

I’m getting the same error when ToastContainer is constructed. None of my other code is calling toast.show, but it appears that the show method is being called when the listener for the ACTION.SHOW event is being created. See screenshot. (content is undefined).

react-toastify screenshot

The app is running in createReactApp development server, not ejected, with react v.16.5.0, react-scripts v.1.1.5

1reaction
fkhadracommented, Mar 15, 2018

Hello @albert-olive,

The issue is coming from here I guess:

componentWillReceiveProps(nextProps) {
    if (nextProps.errorMessage !== '') toast.error(nextProps.errorMessage);
}

It looks like nextProps.errorMessage is undefined. Could you check it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Toast is not rendered (react-toastify component) - Stack Overflow
I just use the sample code from the documentation. Thank you for your help! reactjs · toast · Share.
Read more >
Troubleshooting Guide - React Flow
This guide contains warnings and errors that can occur when using React Flow. We are also adding common questions and pitfalls that we...
Read more >
Understanding the "Objects are not valid as a react child" Error ...
The "Objects are not valid as a React child" error happens when trying to render a collection of data by mistakenly returning the...
Read more >
Refs Must Have Owner Warning - React
You are trying to add a ref to an element that is being created outside of a component's render() function. You have multiple...
Read more >
A Guide to Common React Errors
Error : Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null. ... The...
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