0
votes

I am continously getting this error, when using react-router with typescript and webpack

JSX element type 'Router' does not have any construct or call signatures.

This is how my router is configured

import * as React from 'react';
import * as Router from 'react-router';
import { Route, IndexRoute, hashHistory } from 'react-router';

const Temp = () => {
    return (
        <div>
            temp page.
        </div>
    );
};

export default (
    <Router history={hashHistory}>
        <Route path='/' component={Temp}>
        </Route>
    </Router>
);

and i m using @types/react-router - 2.0.38

How can i avoid this error and make the router work ?

1

1 Answers

2
votes

So... figured out i was doing it wrong, since ReactRouter is not a default export in react-router. This made it work

import * as React from 'react';
import { Router, Route, IndexRoute, hashHistory } from 'react-router';