Skip to content
Advertisement

Exporting component as default and regular

I’ve seen in numerous sites, but specifically within libraries like Vuetify, there are these index.ts files that are exporting the same component as default and just regular(?) exports.

import Component from './Component'

export { Component }
export default Component 

What is the point of exporting the same component twice, albeit, differently?

Advertisement

Answer

Actually it just helps the user to import things in the way he or she wants. They can choose to import it:

import { foo } from "./bar"

or

import foo from "./bar"

Advertisement