I have a component where I use export default:
export default CategoryCard = (props) => {
const {name, color, onPress } = props
return ( ..my code
and so the import statement is import CategoryCard
.
When I try to run in the browser using Expo Client the browser returns error "ReferenceError: CategoryCard is not defined"
if I change
export default CategoryCard
to export const CategoryCard
and change import CategoryCard
to import { CategoryCard }
then things work fine in browser.
I understand the difference between the statements and I am not overly concerned here as this is a native app that won't run in a browser ultimately - but I'm just curious for my own learning what is going on here and why the broswer doesn't like the export default.