How to export more than one variable in ES6?

Sometimes, we want to export more than one variable in ES6.

In this article, we’ll look at how to export more than one variable in ES6.

How to export more than one variable in ES6?

To export more than one variable in ES6, we can put all the variables in the curly braces.

For instance, we write

store.js

const testObject = Parse.Object.extend("TestObject");
const post = Parse.Object.extend("Post");

export { testObject, post };

to export the testObject and post in a module.

Then we import the members from store.js with

import { testObject, post } from '../store'

Conclusion

To export more than one variable in ES6, we can put all the variables in the curly braces.