The most impactful step is to use a Set instead of the array as the. The Set is a slightly better fit here as we only need to know the ids of all selected items instead of a key-value pair. As we’ve analyzed some of the problems with the original code let’s start to refactor it step by step. The change isn’t trivial.

14m read timeFrom profy.dev
Post cover image
Table of contents
The Component To ReviewProblems With The Original CodeThe RefactoringFinal CodeTakeaways

Sort: