I've defined a function in a file but when I export and try to access the return value, I got an undefined error.
Here is my function:
export default function produits(){
return [{nom:"chaussure",prix:45}, {nom:"polo",prix:8}]
}
When in the other file I do
import {produits} from './mesprod.js
and i don't know why i get that error.
But i've just tried to change the export line of my function by removing default
keyword then everything goes fine.
So what is the difference between
export default function functionName()
and
export function functionName(
)
and
export default function()
and i dont really understand the use of { }
when importing a module although i use it all the time.I'm a beginner in React js