Skip to content
Advertisement

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>
      ))}

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement