mirror of
https://github.com/Snigdha-OS/package-browser.git
synced 2025-09-20 19:45:01 +02:00
feat: Optimize package sorting with useMemo
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
JSX
|
||||
JSX,
|
||||
useMemo
|
||||
} from 'react';
|
||||
|
||||
import {
|
||||
@@ -25,7 +26,10 @@ export function PackageList({
|
||||
</div>
|
||||
);
|
||||
|
||||
const sortedPackages = [...packages].sort((a, b) => a.name.localeCompare(b.name));
|
||||
const sortedPackages = useMemo(
|
||||
() => [...packages].sort((a, b) => a.name.localeCompare(b.name)),
|
||||
[packages]
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="grid gap-4">
|
||||
|
Reference in New Issue
Block a user