matt HOFFNER commited on
Commit
1f57b62
Β·
1 Parent(s): c098e98

next.js expert now

Browse files
src/components/WebSearchResults.jsx CHANGED
@@ -59,3 +59,14 @@ export default function WebSearchResults({ aiResponse, results }) {
59
  </div>
60
  );
61
  }
 
 
 
 
 
 
 
 
 
 
 
 
59
  </div>
60
  );
61
  }
62
+
63
+
64
+ export async function getStaticProps(context) {
65
+ // You can access the query parameters of the request with context.query
66
+ const searchParams = context.query;
67
+
68
+ // TODO: Perform any necessary operations with searchParams
69
+
70
+ // Return searchParams as a prop to your page
71
+ return { props: { searchParams } };
72
+ }
src/{app/page.jsx β†’ pages/index.js} RENAMED
@@ -1,6 +1,7 @@
1
  import HomeHeader from "@/components/HomeHeader";
2
  import HomeSearch from "@/components/HomeSearch";
3
  import Image from "next/image";
 
4
 
5
  export default function Home() {
6
  return (
@@ -23,13 +24,12 @@ export default function Home() {
23
  );
24
  }
25
 
26
-
27
- export async function getStaticProps(context) {
28
- // You can access the query parameters of the request with context.query
29
- const searchParams = context.query;
30
-
31
- // TODO: Perform any necessary operations with searchParams
32
-
33
- // Return searchParams as a prop to your page
34
- return { props: { searchParams } };
35
  }
 
1
  import HomeHeader from "@/components/HomeHeader";
2
  import HomeSearch from "@/components/HomeSearch";
3
  import Image from "next/image";
4
+ import "@/app/globals.css";
5
 
6
  export default function Home() {
7
  return (
 
24
  );
25
  }
26
 
27
+ export async function getServerSideProps(context) {
28
+ // You can access the query parameters of the request with context.query
29
+ const searchParams = context.query;
30
+
31
+ // TODO: Perform any necessary operations with searchParams
32
+
33
+ // Return searchParams as a prop to your page
34
+ return { props: { searchParams } };
 
35
  }