Home reactjs Problem with creating Placemark when working with react-yandex-maps

Problem with creating Placemark when working with react-yandex-maps

Author

Date

Category

I am trying to create a label in a map component using react-yandex-maps.
Until I add coordinates for the placemark, the application works correctly, the map is displayed. However, as soon as I add the coordinates for the label, I get the error: TypeError: Cannot read property ‘deserialize’ of undefined.

The following is the component code:

import React from 'react';
import './map-block.css';
import {YMaps, Map, Placemark} from 'react-yandex-maps';
const MapBlock = () = & gt; {
  const mapState = {center: [59.939151, 30.329355], zoom: 16};
  return (
    & lt; section id = "map" className = "map container" & gt;
      & lt; YMaps & gt;
        & lt; Map state = {mapState} className = "map container" & gt;
          & lt; Placemark geometry = {{coordinates: [59.940000, 30.32215]}} / & gt;
        & lt; / Map & gt;
      & lt; / YMaps & gt;
    & lt; / section & gt;
  )
};
export default MapBlock;

Can someone explain what could be the reason? Thanks in advance


Answer 1, authority 100%

You don’t need to specify “coordinates”, it works if you just specify geometry = {[59.940000, 30.32215]}. Apparently the examples I looked at earlier were not correct.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions