0

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.

Josue Toledo
  • 349
  • 2
  • 3
  • 8
  • Please post a small, complete version of the actual code. For SO to work as it does, the link you've provided in the description may at some point go stale/cease to exist - posting the code in here means faster/accurate responses to your issues and when someone googles it long afterwards, it is a complete problem with solution. – Chris Cousins Aug 17 '18 at 20:55
  • My bad. Done. Hope this one is better. – Josue Toledo Aug 17 '18 at 21:18
  • Hmm, I can't see an issue; can you show your "systemjs.config.js" file and (if you are using webpack) perhaps your webpack.config.js file too? – Chris Cousins Aug 18 '18 at 01:32

0 Answers0