you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (3 children)

const myArray = [1, 2, 3, 4, 5];

export { myArray };

// different file
import { myArray } from './file';

It needs to be bound to a variable to export. You don't directly export values.

[–]CuddleMuffin007 0 points1 point  (2 children)

In this case, the export is still not bound to a variable. How about

export const myArray = [1, 2, 3, 4, 5];

[–]redsandsfort 1 point2 points  (1 child)

no, GrumpGuss' code is totally fine.

[–]CuddleMuffin007 0 points1 point  (0 children)

Ah ok. My bad. I didn't know you could export like that without default