导出默认不起作用的webpack,reactjs

贡萨雷斯

我是webpack的新手,我开始使用webpack构建应用程序并做出15的反应,但是这就像导出默认设置无法正常工作,因为找不到应用程序组件时出现错误:

 5:9  App not found in './components/App'  import/named

在我的index.js的代码下面:

import React from 'react';
import ReactDOM from 'react-dom';
import {Router,Route,IndexRoute,browserHistory} from 'react-router';
import { Provider } from 'react-redux';
import {App} from './components/App';
import {HomePage} from './components/HomePage';

import configureStore from './store/configureStore.js';
import { syncHistoryWithStore } from 'react-router-redux';



const store = configureStore();

const history = syncHistoryWithStore(browserHistory, store);
ReactDOM.render(
    <Provider store={store}>
        <Router history={history}>
            <Route path="/" component={App}>
                <IndexRoute component={HomePage}/>



            </Route>


        </Router>

    </Provider>,
    document.getElementById('app')
);

并将我的App.js代码放在components文件夹下:

import React, { PropTypes } from 'react';


const App = (props) => {
  return (
    <div>
      {props.children}
    </div>
  );
};

App.propTypes = {
  children: PropTypes.element
};

export default App;

谁能看到这个问题?似乎不支持这种类型的导出,我必须启用某些功能吗?感谢任何帮助!

婚姻

省略花括号:

import App from './components/App';

这就是技巧default请参阅

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章