import flashMessage from './flash-message'; (name of js file)
flashMessage("Hello");
export default function(message) {
alert(message)
}
(because we're using 'default' export, flashMessage could be named anything)
(in order to export multiple functions from a single module, need to use named exports)
export function alertMessage(message) {
alert(message);
}
export function logMessage(message) {
console.log(message);
}
import {alertMessage, logMessage} from './flash-message';
or for multiple imports:
import * as flash from './flash-message';
flash.alertMessage('Hello from alert');
flash.logMessage('Hello from log');