mercredi 7 février 2018

Is this a bad pattern use Map() as react state?

I'm building a component that saves in his state the selected items. I can use a array for this, but for search it'll be O(n). This is not a big issue because it's a few items. But I was thinking of use Map() to search the items in O(1). Is this a bad pattern? Should I use a array or something else? Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire