How to import both default and named from an ES6 module [duplicate]

The correct syntax to import both default and named exports from ES6 module is to pass the default name (whatever one wants), and named, not-default modules separated by a comma:

Example: index.js

import browsers, { otherValue } from './browsers';

in an exemplary file tree:

.
└── src
    ├── browsers.js
    └── index.js

Often encountered real life example:

import React, { useState, useEffect } from 'react';

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)