Let's assume that we want to export the following variable:
javascriptlet tees = [ { color: 'pink', price: 10 }, { color: 'red', price: 20 }, { color: 'black', price: 30 } ];
To export the variable by default:
javascriptlet tees = [ { color: 'pink', price: 10 }, { color: 'red', price: 20 }, { color: 'black', price: 30 } ]; export default tees;
Then, we can import the variable:
javascriptimport tees from './tees';
javascriptexport let tees = [ { color: 'pink', price: 10 }, { color: 'red', price: 20 }, { color: 'black', price: 30 } ];
Then, we can import the variable:
javascriptimport { tees } from './tees';
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.