From aa8e8fe89dc89ef8bc8ecf4def6b7c711519152f Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 12 Oct 2020 10:58:41 -0300 Subject: [PATCH] Prefetch Search --- components/core/Searchbar/Searchbar.tsx | 13 ++++++++-- .../product/ProductView/ProductView.tsx | 7 ++++-- pages/index.tsx | 24 ++++++++++++------- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/components/core/Searchbar/Searchbar.tsx b/components/core/Searchbar/Searchbar.tsx index 47aeed316..5f9d52ed6 100644 --- a/components/core/Searchbar/Searchbar.tsx +++ b/components/core/Searchbar/Searchbar.tsx @@ -1,13 +1,14 @@ import cn from 'classnames' import { FC } from 'react' import s from './Searchbar.module.css' - +import { useRouter } from 'next/router' interface Props { className?: string children?: any } const Searchbar: FC = ({ className }) => { + const router = useRouter() return (
= ({ className }) => { className )} > - + { + e.preventDefault() + router.push('/search') + console.log('changing') + }} + />
= ({ product, className }) => { return (
-

+

{product.name}

@@ -102,7 +102,10 @@ const ProductView: FC = ({ product, className }) => {
-
+