javascriptreactjsgoogle-mapsgoogle-maps-api-3react-google-maps

How to change marker label color of react-google-maps


I am using @react-google-maps/api library. I've integrated google map but I am facing marker label color, I tried very hard but didn't find any solution. Could someone please help me with how to resolve this issue.

import {
  Marker,
} from "@react-google-maps/api";

{markers.map(({ id, name, position }) => (
        <Marker
          key={id}
          position={position}
          onClick={() => handleActiveMarker(id)}
          label={`${id}`}
        >
          {activeMarker === id ? (
            <InfoWindow onCloseClick={() => setActiveMarker(null)}>
              <div>{name}</div>
            </InfoWindow>
          ) : null}
        </Marker>
      ))}

Solution

  • Try this: label: {text: `${id}`, color: "blue"}