diff --git a/src/components/products/Products.js b/src/components/products/Products.js
index 7e65d2b..5f95439 100644
--- a/src/components/products/Products.js
+++ b/src/components/products/Products.js
@@ -1,12 +1,5 @@
import Link from 'next/link';
-
-export const getStaticProps = async () => {
- const res = await fetch("https://fakestoreapi.com/products");
- const data = await res.json();
- return { props: { products: data } };
-};
-
export default function Products({ product }) {
return (
diff --git a/src/pages/Search.js b/src/pages/Search.js
index 5bfea57..24f523c 100644
--- a/src/pages/Search.js
+++ b/src/pages/Search.js
@@ -1,28 +1,22 @@
import React, { useState } from "react";
+import SearchPage from "./SearchEngPage/SearchPage";
-function Search({ products }) {
+export default function Search({ products }) {
const [searchInput, setSearchInput] = useState("");
+ console.log(products)
function handleInput(event) {
setSearchInput(event.target.value);
}
function handleSearch() {
- for (const element of products) {
- if (element.title == searchInput) {
-
- {products.map((product) => {
- return (
-
-

-
{product.title}
-
View Product
-
- );
- })}
-
;
+ products.filter((product)=>{
+ if (searchInput == product.title) {
+ return
;
+ } else {
+ return
Not Found
;
}
- }
+ })
}
return (
@@ -46,7 +40,7 @@ function Search({ products }) {