我的代碼的組織結構如下:Index.js模塊導入用的WebPack
其中,
資源/ ActionLog /組件/ Layout.js
import React from 'react';
export default class Layout extends React.Component {
render() {
return (
<p>Test</p>
);
}
}
資源/ ActionLog/Components/index.js
export * from './Layout';
個
資源/ ActionLog/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import Layout from './Components'; // <--- ISSUE HERE.
const app = document.getElementById('app');
ReactDOM.render(
<Layout/>,
app
);
爲什麼Layout
沒有得到使用此設置進口?
如果我改變讀取行,
import Layout from './Components/Layout';
它工作正常,但在其他方面Layout
永遠是不確定的!即使如果我嘗試,
import Layout from './Components/index';
我使用的WebPack作爲我模塊捆綁,和之前已經取得了類似的事情,我只是不明白爲什麼/這怎麼是不同的..
你,善良的先生,是一大福音。爲此歡呼,我想我仍然需要刷新我的ES6。 –