我在使用parceljs
and uirouter
with 时遇到问题react
。当我转到命令行并编写parcel index.html
一切正常时,但是当我转到浏览器时,浏览器中没有任何内容,当我转到控制台时,它会抛出此错误:Uncaught TypeError: Cannot redefine property: UIRouter
. 我真的不知道我错过了什么。
顺便说一句,我正在做UIRouter React
教程。教程链接(https://ui-router.github.io/react/tutorial/helloworld)
import React from 'react';
import ReactDOM from 'react-dom';
import {UIRouter, UIView, UISref, UISrefActive, pushStateLocationPlugin} from '@uirouter/react';
var helloState = {
name: 'hello',
url: '/hello',
component: () => <h3>hello world</h3>
}
var aboutState = {
name: 'about',
url: '/about',
component: () => <h3>Its the UI-Router hello world app!</h3>
}
ReactDOM.render(
<UIRouter plugins={[pushStateLocationPlugin]} states={[helloState, aboutState]}>
<div>
<UISrefActive class="active">
<UISref to="hello"><a>Hello</a></UISref>
</UISrefActive>
<UISrefActive class="active">
<UISref to="about"><a>About</a></UISref>
</UISrefActive>
<UIView/>
</div>
</UIRouter>,
document.getElementById('react-app')
);
这是代码。