I am trying to render a div that is supposed to display a purple square, through mapping an array of objects (box).
the square does not render, but console logging does work for some reason.
const FaceRecognition = ({ imgURL, box }) => {
const Square = (box) => {
box.map( (square,i ) => {
return (
<div key={i}
className='bounding-box'
style={{ top: square.topRow, right: square.rightCol, bottom: square.bottomRow, left: square.leftCol }}>
{console.log("square calculated")}
</div>
)
})
}
return (
<div className='center ma'>
<div className="absolute mt2" >
<img id='inputimage' src={imgURL} width='500px' height='auto' alt="" />
{Square(box)}
{/* <div className='bounding-box' style={{ top: box.topRow, right: box.rightCol, bottom: box.bottomRow, left: box.leftCol }}></div> */}
</div>
</div>
)
}
enter image description here
i have attached an image of the code here if its any better than the body text
the square div was displaying normally when i tried rendering it through the parent function return, without mapping - where commented line is in the attached image.
i would love to see what im doing wrong here.