Skip to content

Instantly share code, notes, and snippets.

@paulhhowells
Last active June 26, 2020 11:56
Show Gist options
  • Save paulhhowells/26b699b68f84fb2e7c257cf0e627ef75 to your computer and use it in GitHub Desktop.
Save paulhhowells/26b699b68f84fb2e7c257cf0e627ef75 to your computer and use it in GitHub Desktop.
ES6 import & export

ES6 imports and exports

// myThing.js

Default

export

export default function () {}

export default function myThing () {}

function myThing () {}

export { myThing as default };
const myThing = () => {};

export default myThing;

import

import myThing from 'myThing';

Named

export

export function myOtherThing () {}

export const myOtherThing = () => {};

import

import { myOtherThing } from 'myThing';

Import default and named

import myThing, { myOtherThing } from 'myThing';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment