0

I am switching over to ES6, and I have that concern right now.

var RouteHandler = require('react-router').RouteHandler;

I did import RouteHandler from 'react-router'.RouteHandler, and webpack is giving me an error.

So, how should I import it ?

Non
  • 8,409
  • 20
  • 71
  • 123
  • Not familiar with ES6, but couldn't you just import react-router and do sth like `var RouteHandler = router.RouteHandler`? – Florian Wendelborn Jul 25 '15 at 05:04
  • @Dodekeract yes, I can just I have it and as I posted in my question `var RouteHandler = require('react-router').RouteHandler;`, but I want to now the ES6 way :) – Non Jul 25 '15 at 05:05

1 Answers1

2

Try import {RouteHandler} from 'react-router'

Alternatively, you could have done:

import * as reactRouter from 'react-router';
var RouteHandler = reactRouter.RouteHandler;
jmar777
  • 38,796
  • 11
  • 66
  • 64