score:5

Accepted answer

you can't have multiple default exports, but you can have multiple (non-default) exports.

try adding export before the function keywords, like export function blogdescription() {

then to import them you would do import { blogdescription } from './myfile'

score:0

the hole point of an export default is that when another file imports from this file without specifying a name it will fall back to the default, if there were several defaults on the file it would defeat this purpose, what you want, is to export each function and you can then have one of those as the default for the module, so in your case:


export function blogtrends(props) {

export function blogdescription() {

...

export default blogtrends


then on your importing file you can do:

import { blogtrends } from 'pathtofile' ---> imports blogtrends function.

import { blogdescription } from 'pathtofile' ---> imports blogdescription function.

import default from 'pathtofile' ---> imports blogtrends function.


reference:

https://developer.mozilla.org/en-us/docs/web/javascript/reference/statements/export

score:0

exporting multiple functions

export default mymainfunc;
export { mysecondfunc };

Related Query

More Query from same tag