2

What is the difference between using

import { Devices } from '../models/devices';

and

import Devices from '../models/devices';

I haven't been able to google this one out yet.

Bazinga777
  • 5,140
  • 13
  • 53
  • 92
  • See similar question: http://stackoverflow.com/questions/33524696/es6-destructuring-and-module-imports/33524809 – just-boris Nov 14 '15 at 17:19

1 Answers1

2

I believe the first is a Named-Import and the second is a Default-Binding.

In simple English, I think the first one means "from all the stuff that was exported in ../models/devices, import only the Devices object". While the second one means "whatever is the default export of ../models/devices, import it as the name Devices.

See the standard. I must admit, though, I'm not 100% my interpretation is correct. That document was not written for mere humans to read, it seems... :/

Assaf Lavie
  • 73,079
  • 34
  • 148
  • 203