Spaces:
Paused
Paused
matt HOFFNER
commited on
Commit
Β·
88ab17b
1
Parent(s):
a292c9d
20 ways to do a thing
Browse files
src/{pages/index.js β app/page.jsx}
RENAMED
File without changes
|
src/app/search/web/page.jsx
CHANGED
@@ -2,14 +2,18 @@
|
|
2 |
import { useEffect, useState } from "react";
|
3 |
import { MemoizedReactMarkdown } from '../../../components/MemoizedReactMarkdown'
|
4 |
import { CodeBlock } from '../../../components/CodeBlock';
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
export default function WebSearchPage({ params, searchParams }) {
|
7 |
const [aiResponse, setAiResponse] = useState("");
|
8 |
const [searchTerm, setSearchTerm] = useState()
|
9 |
|
10 |
useEffect(() => {
|
11 |
-
console.log(
|
12 |
-
setSearchTerm(searchParams.searchTerm)
|
13 |
}, [searchParams])
|
14 |
|
15 |
useEffect(() => {
|
@@ -103,13 +107,4 @@ export default function WebSearchPage({ params, searchParams }) {
|
|
103 |
</MemoizedReactMarkdown>
|
104 |
</div>
|
105 |
);
|
106 |
-
}
|
107 |
-
|
108 |
-
|
109 |
-
export async function getInitialProps(context) {
|
110 |
-
// You can access the query parameters of the request with context.query
|
111 |
-
const searchParams = context.query;
|
112 |
-
|
113 |
-
console.log(context);
|
114 |
-
return { props: { searchParams } };
|
115 |
}
|
|
|
2 |
import { useEffect, useState } from "react";
|
3 |
import { MemoizedReactMarkdown } from '../../../components/MemoizedReactMarkdown'
|
4 |
import { CodeBlock } from '../../../components/CodeBlock';
|
5 |
+
import { useSearchParams } from 'next/navigation'
|
6 |
+
|
7 |
+
|
8 |
+
export default function WebSearchPage() {
|
9 |
+
const searchParams = useSearchParams()
|
10 |
|
|
|
11 |
const [aiResponse, setAiResponse] = useState("");
|
12 |
const [searchTerm, setSearchTerm] = useState()
|
13 |
|
14 |
useEffect(() => {
|
15 |
+
console.log(searchParams);
|
16 |
+
setSearchTerm(searchParams.get('searchTerm'))
|
17 |
}, [searchParams])
|
18 |
|
19 |
useEffect(() => {
|
|
|
107 |
</MemoizedReactMarkdown>
|
108 |
</div>
|
109 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
}
|