title: React warning Maximum update depth exceeded
body: <p>This is a follow up question to this question which is the nearest to my issue:</p>
  
  <p><a href="https://stackoverflow.com/questions/53070970/infinite-loop-in-useeffect">Infinite loop in useEffect</a></p>
  
  <p>I am creating a small React.js app to study the library. I'm getting this warning:</p>
  
  <blockquote>
    <p>Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.</p>
  </blockquote>
  
  <p>I got a functional component, in which there is this code:</p>
  
  <pre><code>const propertiesMap2 = new Map([  //There is also propertiesMap1 which has the same structure
  ["TITLE4",
      {
          propertyValues: {
              myProperty10 : "myVal1",
              myProperty11 : "myVal2",
              myProperty12 : "myVal3",                                                            
          },
          isOpen: true
      }
  ],
  ["TITLE5",
      {
          propertyValues: {
              myProperty13 : "myVal4",
              myProperty14 : "myVal5",
              myProperty15 : "myVal6",                                                             
          },
          isOpen: true
      }
  ],
  ["TITLE6",
      {
          propertyValues:{
              myProperty16 : "myVal7",
              myProperty17 : "myVal8",
              myProperty18 : "myVal9",
          },
          isOpen: true
      }                                                        
  ]
  ]);
  
  const [properties, setPropertiesMapFunc] = useState(new Map());
  useEffect(()=&gt;
  {
      let mapNum = Number(props.match.params.id);
      setPropertiesMapFunc(mapNum === 1 ?propertiesMap1 : propertiesMap2);
  }, [properties]);
  </code></pre>
  
  <p>The correct properties map is chosen each time, but like I said I get this error. Why do I get it, if the <code>propertiesMap</code> is constant without anything changing, and <code>properties</code> was passed as a parameter to <code>setEffect</code>, so I thought it would only re render when something there changes..</p>