It’s very unlikely that userInfo
changes just because you're inside apps.map()
, JavaScript doesn’t work that way. What’s more likely is that your userInfo
value is being updated somewhere (maybe from an async call or due to state updates), and you're seeing different values at different points in the render. If you’re using a state management library like Zustand or Redux, it might be re-rendering the component when the store updates. Also, if you're using React Strict Mode (which is on by default in development), React may render components twice to help catch bugs, which can make it look like values are changing unexpectedly. Try logging userInfo
both inside and outside the .map()
to compare them and see what’s happening. Most likely, it’s not about .map()
itself, but about when and how your state is being updated