Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
React-Bootstrap Modal component

I have react component and im trying to paste bootstrap Modal. When i paste it in component my page appears blank and errors in console. My component:

import { observer } from 'mobx-react-lite';
import React, { useEffect,useRef,useState } from 'react'
import 'bootstrap/dist/css/bootstrap.min.css';
import {Modal, Button} from 'react-bootstrap';

const Canvas = observer(() => {
    const canvasRef=useRef()
    useEffect(()=>{
        canvasState.setCanvas(canvasRef.current)
        toolState.setTool(new Brush(canvasRef.current))
    }, [])                                          

    return (
        <>
        <div className="canvas">
/* This is Modal component causing errors */
         <Modal show={true} onHide={()=>{}}>
        <Modal.Header closeButton>
          <Modal.Title>Modal heading</Modal.Title>
        </Modal.Header>
        <Modal.Body>Woohoo, you're reading this text in a modal!</Modal.Body>
        <Modal.Footer>
          <Button variant="secondary" onClick={()=>{}}>
            Close
          </Button>      
        </Modal.Footer>
      </Modal>

        <canvas onMouseDown={()=>mouseDownHandler()} ref={canvasRef} width={600} height={400}></canvas>
        </div>
        </>
    )
});

export default Canvas;

The errors

I have installed react-bootstrap using command npm install react-bootstrap bootstrap. I have also included styles to my index.html file

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
  integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
  crossorigin="anonymous"
/>

What could be the problem?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!