因此,我正在构建一个 react-JS 网站,并使用 express 服务于后端。我正在使用 react-router 和 react-stormpath 进行身份验证。也使用 webpack。我在加载引导 javascript 时遇到问题。我安装了 react-bootstrap 并从 express 提供 css 文件,没有问题。但是,当我尝试渲染时,我收到了几个错误,一个与 ReactDOM not Recogniz 相关
ReactDOM(Uncaught ReferenceError: ReactDOM is not defined(…))
,另一个与bootstrap(Uncaught TypeError: Cannot read property 'PropTypes' of undefined(…) & Uncaught SyntaxError: Unexpected token :)
. 这是我的第一个 React 应用程序,任何帮助将不胜感激!
/* jshint esversion: 6 */
import React, { PropTypes } from 'react'
import ReactDOM from 'react-dom'
import { LoginLink } from 'react-stormpath'
import ReactStormpath, { Router, HomeRoute, LoginRoute, AuthenticatedRoute } from 'react-stormpath'
import { Link, IndexRoute, Route, browserHistory } from 'react-router'
import { MasterPage, IndexPage, LoginPage, RegistrationPage, ProfilePage } from './pages'
import Index from './components/Index'
import index from './pages/index'
console.log("app.js loaded");
ReactStormpath.init();
ReactDOM.render(
<Router history={browserHistory}>
<HomeRoute path='/' component={MasterPage}>
<IndexRoute component={IndexPage} />
<LoginRoute path='/login' component={LoginPage} />
<Route path='/register' component={RegistrationPage} />
<AuthenticatedRoute>
<HomeRoute path='/profile' component={ProfilePage} />
<Route path='/:user/lists' component={List} />
</AuthenticatedRoute>
<Route path='/lists' component={List} >
<Route path="/lists/:list" component={List} />
</Route>
</HomeRoute>
</Router>,
document.getElementById('app')
);
ReactDOM.render(
<ListForm />,
document.getElementById('app')
);