0
state = {
  markers : [
      { coordinate: {
        latitude: null,  
        longitude: null,
      },
      title: "",
      description: "",
      image: "",
    },
  ],
  region: {
      latitude: 45.52220671242907,
      longitude: -122.6653281029795,
      latitudeDelta: 0.04864195044303443,
      longitudeDelta: 0.040142817690068,
          }
  };

how can i change the value of marker[0].coordinate.latitude using setState please answer.

Akhil Nayak
  • 403
  • 4
  • 8
  • A similar question as here: https://stackoverflow.com/questions/29537299/react-how-to-update-state-item1-in-state-using-setstate – DcoderZ Apr 05 '20 at 13:15

1 Answers1

0

"Maximum update depth exceeded in react native".

This problem arises when you have

  1. using setState in a loop

  2. using setState directly inside render function

  3. even worst-case using setState many times in a single component

Make sure you have not under the first two conditions.

If you want to use setState more times as you wish, try to split up the components as sub-components and try to combine the setState updates.

Dhevendhiran M
  • 994
  • 2
  • 12
  • 29