title: How do I correctly clone this Map?
body: <p>In my React app, at one point I'm trying to copy a Map from an object, but it's not working for me.</p>
  <p>The initial user object has the structure:</p>
  <p>user: {
  videoTracks: Map,
  ... other fields...
  }</p>
  <p>If I do a console log on user, I get this for videoTracks:</p>
  <p><a href="https://i.stack.imgur.com/f4L56.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f4L56.png" alt="enter image description here" /></a></p>
  <p>Then I do this: <code>const newVideoTracks = user.videoTracks;</code></p>
  <p>and I would expect newVideoTracks to be the same as the first image, but instead I get the following:</p>
  <p><a href="https://i.stack.imgur.com/0NUwy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0NUwy.png" alt="enter image description here" /></a></p>
  <p>It has 2 entries and size:2, but it says Map(1) at the top.</p>
  <p>I know the console isn't always accurate, but in this case when I subsequently use newVideoTracks, it behaves as though there is only 1 entry.</p>
  <p>I assume I need to do some cloning rather than just copying it, so I tried both of the following:</p>
  <p><code>const newVideoTracks = new Map(user.videoTracks);</code> - this didn't make any difference</p>
  <p><code>const newVideoTracks = Object.assign({}, user.videoTracks)</code> - caused a crash</p>
  <p>What's the correct way to do this?</p>