0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【React】 Uncaught Error: App(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null. エラーの解決方法 【Create React App】

Posted at

エラーが発生

  • Reactアプリ開発中、コンパイルエラーは発生していないが、画面が何も表示されなくなった
  • Chromeのコンソールには以下のエラーが表示
react-dom.development.js14169
Uncaught Error: App(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.

エラーの原因

return 部分を誤って削除してしまっていた

App.js
import React from 'react';
import './App.css';
import './service/firebase';
import Header from './components/Header';

function App() {
    // 原因: 以下をreturnしていない
    <div className="App">
      <Header />
    </div>
}

export default App;

エラーの解決方法

return してあげたらエラーが無くなり画面が表示される

App.js
import React from 'react';
import './App.css';
import './service/firebase';
import Header from './components/Header';

function App() {
  return (
    <div className="App">
      <Header />
    </div>
  );
}

export default App;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?