export 'default' (reexported as 'Navbar') was not found in './Navbar/Navbar'

Viewed 1053

The error persists , I don't know how to solve it because im new to React. I tried some answers on stack overflow but they don't seem to work, maybe I lack the knowledge to see what is causing the error.

Here is the code that's causing the error:

export { default as Navbar} from './Navbar/Navbar';
export { default as Products} from './Products/Product';

Here is the Navbar.jsx code:

import React  from 'react';
import { AppBar, Toolbar, IconButton, Badge, MenuItem, Menu, Typography } from '@material-ui/core';
import { ShoppingCart } from '@material-ui/icons';
import logo from '../../assets/logo.jpg';


import useStyles from './styles';

const Navbar=() => {
    const classes = useSyles();
  return (
   <>
  <AppBar position="fixed" className={classes.appBar} color="inherit">
    <Toolbar>
        <Typography variant="h6" className={classes.title} color="inherit">
            <img src={logo} alt="Commerce.js" height="25px" className={classes.image} />
              Commerce.js
           </Typography>

        <div className={classes.grow} />

            <div className={classes.button}>
              <iconButton aria-label="Show cart items" color="inherit" >

              </iconButton>
              <Badge badgeContent={2} color="secondary" >

                <ShoppingCart/>
              </Badge>

              </div>
      </Toolbar>

      </AppBar>

</>

)


}

Here is how it looks inside Visual Code: Inside Visual Studio

2 Answers

change const Navbar=() => {

to export default const Navbar=() => {

You are missing exporting those components as default. Please add

export default Navbar to the Navbar.js file. export default Products to the Products.js file.

Related