What the error? React: Nothing was returned from render. | Owen Conti

What the error? React: Nothing was returned from render.

Published on May 22, 2019 in category React.

๐Ÿ‘‹There's a video version of this post at the bottom of the page.

Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null

This warning happens when you're missing a return statement in your render function, or you attempt to return early, but return void via return; instead of returning null.

function App() {
    if (props.loading) {
        return; // Bad! Should return `null` here instead
    }

    return null; // Fixed!
}


Thanks for reading!

๐Ÿ‘‹ Hi there! I hope you enjoyed this post. If you did, follow me on Twitter, @owenconti, for updates on new posts.

If you prefer to receive updates via email, subscribe to my newsletter where I send a weekly summary of the content I've released.

Feel free to check out other posts in the React category.