Hi I've noticed that the
payload-types
generated for
array
fields always have an optional
id?: string
.
From what I've seen, ids are always automatically generated for array items. Is it safe to assume they will always be generated? And if not, when are they not generated?
I'm asking because I plan to do
key={option.id}
in my React front end
When is an
id
undefined on a row of an
array
field?
I think it's so you can use the same type for type safe create. I could be wrong, but to me it's the only logical scenario when
id
would not exist
Thanks for the reply @itsjxck, that makes a lot of sense and I think you're right
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.