getItemById
Finds an item in an array of objects by ID.
Usage
import { getItemById } from "@airsoko/react";
const items = [
{ id: 1, name: "Item 1" },
{ id: 2, name: "Item 2" },
{ id: 3, name: "Item 3" },
];
const itemId = 2;
const foundItem = getItemById(items, itemId);
console.log(foundItem); // Output: { id: 2, name: 'Item 2' }Parameters
items: The array of items to search.id: The ID of the item to find.
Returns
The item with the matching ID, or undefined if no match is found.