Skip to content

Instantly share code, notes, and snippets.

@rajat2502
Last active June 13, 2020 18:01
Show Gist options
  • Save rajat2502/07c9c0d51981d4a6ddc05654cb8ca7c4 to your computer and use it in GitHub Desktop.
Save rajat2502/07c9c0d51981d4a6ddc05654cb8ca7c4 to your computer and use it in GitHub Desktop.
// 1. Import one or more named exports from the module
// Syntax
import { <named_export_value> } from '<path_of_module_from_current_module>';
// path can be relative or absolute depending upon the configuration of the project
// For Example:
import { users, tasks } from './export.js';
// This will import the users and tasks arrays into the current module
// 2. Import default
// Syntax
import <default_export_value> from '<path_of_module_from_current_module>';
// path can be relative or absolute depending upomn the configuration of the project
// For Example:
import logUser from './export.js';
// This will import the function logUser into this module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment