2017-03-06 6 views
0

私はcreate-react-appを使ってサンプルアプリケーションを作成しましたが、npm startを実行するとデフォルトのreact jsページが表示されました。私はその後、react-appのnpm startには何も表示されていません

import React from 'react'; 
import ReactDOM from 'react-dom'; 

ReactDOM.render(
    <h1>Hello, world!</h1>, 
    document.getElementById('root') 
); 

にSRC内部app.jsを編集したが、これはnpm startを行う上で空白のページが表示されます。私はチェックし、既にindex.htmlに<div id="root">があった。だからこそ空白のページが表示されていますか?私はコンソールをチェックして、それが2つのエラーを示し

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in. 

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in. 

答えて

0

[OK]を、私はそれを得ました。 (それがデフォルトに言及したため、ページを反応させる)、私は実行、または

import React from 'react'; 

const App =() =>{ 
    return (<h1>Hello, world!</h1>); 
}; 

export default App; 

のような何かをすること例えばIndex.jsを編集するために必要な間、私はSRC内App.jsを編集し、これを必要な変更を行いますindex.jsにあります。

関連する問題