score:1

Accepted answer

i think the issue is where you spread the old state into setstate the state has gone stale. react does some performance enhancements around setstate that will make code like this not work as expected.

one thing to try is using the setstate callback.

setstate((state) => ({
                ...state,
                projectlist: sorted
            }));

Related Query

More Query from same tag