Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

Basic structure of named imports and exports

// 1 - File that exports (let's call it myModule.js)
const functionOne = () => 'ONE';
const functionTwo = () => 'TWO';

export {
  functionOne,
  functionTwo
};

// 2 - Main file that imports the necessary functions from previous one
import {functionOne, functionTwo} from './myModule';

/*SOURCE: The Odin Project*/
Source by www.theodinproject.com #
 
PREVIOUS NEXT
Tagged: #Basic #structure #named #imports #exports
ADD COMMENT
Topic
Name
3+8 =