I just don't see it explicitly mentioned in the React docs for Lists and Keys.
My instinct was to treat them like HTML ID-attribute-safe, which the HTML5 spec says:
The value must not contain any space characters
... also MDN docs.
I was afraid that a worst-case might be that Keys like ice box
, ice cream
, and ice cold
might accidentally get turned into three keys of ice
, which is obviously not what we want.
However, I realize that this isn't HTML. The most specific mention is in the Lists And Keys docs page says
The best way to pick a key is to use a string that uniquely identifies a list item among its siblings.
So, is it safe to use any "unique string", including whitespace?
I am aware that unique item IDs are best, but in my specific use-case I do not have such a thing, nor a slug/safe string. This stemmed from discussion on the extent to which one should avoid using indexes as keys when real IDs aren't available.