Seperated json access code to own file (Brock get AirBnB)

This commit is contained in:
Sarim-Sheikh-2003
2024-02-10 14:16:38 -07:00
parent d5df67ee38
commit d65cdaa80e
7 changed files with 7282 additions and 4014 deletions

11
src/Images/ImageFinder.js Normal file
View File

@ -0,0 +1,11 @@
import imagesData from './Images.json';
// Function to search and filter images based on the provided category
export const ImageFinder = (category) => {
if (category === 'all') {
return imagesData;
} else {
const filteredImages = imagesData.filter(image => image.category === category);
return filteredImages;
}
};