I got a problem using parceljs
and uirouter
with react
. When I go to the command line and write parcel index.html
everything goes fine, but when I go to the browser, nothing appears in the browser and when I go to the console it throws this error: Uncaught TypeError: Cannot redefine property: UIRouter
. I really don't know what I'm missing.
Btw I'm doing the UIRouter React
tutorial.
Link of the tutorial (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')
);
Here is the code.