mirror of
https://github.com/Snigdha-OS/package-browser.git
synced 2025-09-21 03:55:03 +02:00
feat: Optimize package sorting with useMemo
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
JSX
|
JSX,
|
||||||
|
useMemo
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -25,7 +26,10 @@ export function PackageList({
|
|||||||
</div>
|
</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 (
|
return (
|
||||||
<div className="grid gap-4">
|
<div className="grid gap-4">
|
||||||
|
Reference in New Issue
Block a user