Build a Reusable Footer - Build a Reusable Footer

Tell us what’s happening:

If I try to copy the completed project code into a Vite/React app installed on my local computer using VSCode, all I get is a blank screen, but my code passes the freeCodeCamp tests. As soon as I switch the import statement in my index.html file to anything other than the default “./src/main.jsx”, I breaks. Why is that? I was hoping I’d be able to directly replicate projects from fCC in my local environment.

Your code so far

<!-- file: index.html -->
<!doctype html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Reusable Footer Component</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.3.1/umd/react.development.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.3.1/umd/react-dom.development.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/7.26.3/babel.min.js"></script>
    <script
      data-plugins="transform-modules-umd"
      type="text/babel"
      src="index.jsx"
    ></script>
    <link rel="stylesheet" href="styles.css" />
  </head>

  <body>
    <div id="root"></div>
    <script
      data-plugins="transform-modules-umd"
      type="text/babel"
      data-presets="react"
      data-type="module"
    >
      import { Footer } from './index.jsx';
      ReactDOM.createRoot(document.getElementById('root')).render(<Footer />);
    </script>
  </body>
</html>
/* file: styles.css */
* {
  margin: 0;
  padding: 0;
}

footer {
  display: block;
  
}

ul, ol {
  list-style: none;
  padding: 0;
  margin: 0
}

.footer-section {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr
}
/* file: index.jsx */
export const Footer = () => {
  return (
  <footer>
    <div className='footer-section'>
      <div>
        <p>Company</p>
        <ul>
          <li><a href='#'>About</a></li>
          <li ><a href='#'>Careers</a></li>
          <li><a href='#'><i className="fa-solid fa-envelope"></i>Contact Us</a></li>
        </ul>
      </div>
      <div>
        <p>Tools</p>
        <ul>
          <li><a href='#'>Library</a></li>
          <li><a href='#'>Support</a></li>
        </ul>
      </div>
      <div>
        <p>Website</p>
        <ul>
          <li><a href='#'>A-Z Listing</a></li>
          <li><a href='#'>Accessibility</a></li>
          <li><a href='#'>Online/Internet Privacy Statement</a></li>
        </ul>
      </div>
    </div>
    <p>Copyright © Sean Collins</p>
  </footer>
  )
  
};

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36

Challenge Information:

Build a Reusable Footer - Build a Reusable Footer

I do have something resembling a hypothesis but I don’t entirely know it’s accuracy. FreeCodeCamp is using Babel to transform the React code into something that’s compatible with browser-based Javascript.

Vite doesn’t do this and doesn’t mess around with data-plugins and presets.