Setting the file. One moment.
Skill 03 · Vercel React Best Practices
Subchapter 3.38
rules/js-set-map-lookups.mdMarkdown532 BView on GitHub
Convert arrays to Set/Map for repeated membership checks.
Incorrect (O(n) per check):
const allowedIds = ['a', 'b', 'c', ...]
items.filter(item => allowedIds.includes(item.id))Correct (O(1) per check):
const allowedIds = new Set(['a', 'b', 'c', ...])
items.filter(item => allowedIds.has(item.id))