## TL;DR

For "TypeError: Cannot use 'in' operator to search for 'groupTypes' in [email]": i use the MGT React PeoplePicker with selectionMode='multiple' and pass an array of email addresses as selectedPeople. The picker renders with no names or pictures and throws: TypeError: Cannot use 'in' operator to search for 'groupTypes' in [email].

```text
TypeError: Cannot use 'in' operator to search for 'groupTypes' in [email]
```

## Steps

1. I use the MGT React `PeoplePicker` with `selectionMode='multiple'` and pass an array of email addresses as `selectedPeople`. The picker renders with no names or pictures and throws: `TypeError: Cannot use 'in' operator to search for 'groupTypes' in [email]`. Passing Graph IDs instead of emails seems to be the documented usage, but emails should work too. What is wrong?

2. The error is not about emails vs IDs - it is a React state timing bug. `selectedPeople` was being populated after the initial render (e.g. via `useState(null)` then `setGraphIds(others)`), so on first render the picker received `null` and crashed when iterating over it. The fix, confirmed by the reporter: make sure the array is set before the picker first renders, so `selectedPeople` never starts as null. Initialize your state with the array (emails or IDs) up front, or do not render the picker until the array is populated.

## When to use

You are seeing this: Initialize your state with the array (emails or IDs) up front, or do not render the picker until the array is populated. Use this skill when you run into "MGT React PeoplePicker throws `Cannot use 'in' operator` when `selectedPeople` starts as null".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
