So I am trying to be able to mark pins but I get the error. I don’t understand it because I am dealing with an array.
Uncaught TypeError: pins.map is not a function
const [pins, setPins] = useState([]);
const createPins = () => {
return (
<React.Fragment>
{pins.map(p=>(
<Marker
latitude={p.lat}
longitude={p.long}
offsetLeft={-20}
offsetTop={-10}
>
<Room style={{fontSize: viewport.zoom * 7, color: 'stateblue'}}/>
<Popup
longitude={-122}
latitude={37}
anchor="left"
closeButton={true}
closeOnClick={false}
>
<div className='card'>
<label>Place</label>
<h4 className='place'>Beautiful Place</h4>
<label>Review</label>
<p className='desc'>Beautiful place. I like</p>
<label>Rating</label>
<div className='stars'>
<Star className='star'/>
<Star className='star'/>
<Star className='star'/>
<Star className='star'/>
<Star className='star'/>
</div>
<label>Information</label>
<span className='username'>Created by <b>Gion</b></span>
<span className='date'>Created now</span>
</div>
</Popup>
</Marker>
))}
</React.Fragment>
)}
How can I fix it?