Search code examples
cssreactjsreactstrap

Unable to import bootstrap.css in react


Everyone I was trying to build a tic Tac toe game, but in my project I am getting this error I do not know how to solve it, can somebody help why it is showing like this (Please check attached image)

import logo from './logo.svg';
import './App.css';
import Icon from "./components/icon"
import { icons } from 'react-icons';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import {Card,CardBody,Container,Button,Col,Row } from "reactstrap";
import 'bootstrap/dist/css/bootstrap.css';

const itemArray = new Array(9).fill("empty")
function App() {
  return (
    <div className="App">
      <header className="App-header">
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <Icon name="circle"/>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

export default App;

enter image description here


Solution

  • Sounds like NodeJS detected that your module is not installed. Use npm install bootstrap and check how to import correctly the module. Follow the bootstrap website: https://getbootstrap.com/docs/5.0/getting-started/download/

    If it is still not working, just use the CDN. It's lightweight and easy to implement.