Skip to content

Update MarkerClusterer.md to not use index as key #747

@jennyphan

Description

@jennyphan

Issue template

Please update MarkerClusterer.md to not use the index as a key. There is an eslint rule for this
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md. I can also create the pull request if needed. Please let me know.

Please provide an explanation

The clustering will not work properly on updates unless you use a key such as maybe the latitude + longitude. I spent a lot of time trying to figure out why the updates were not creating the clusters properly.

Your Environment

os: mac/linux/windows/android/ios

node --version

react version
16.13.0

webpack version

@babel version

@react-google-maps/api version
1.8.1

How is it behave?

Unless you change it, any updates will not work properly

How should it behave correctly?

Do not use the index as a key. Create another property for the key or use lat+long

basic implementation of incorrect behavior in codesandbox.com

https://codesandbox.io/s/react-typescript-playground-n0z9f

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions