Commit 2b9b53cb authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

fix: search value is empty when refresh;

parent 6e380580
...@@ -91,6 +91,7 @@ function Navbar(props) { ...@@ -91,6 +91,7 @@ function Navbar(props) {
React.useEffect(() => { React.useEffect(() => {
setSearch(router.query?.q ?? ""); setSearch(router.query?.q ?? "");
console.log(router.query);
}, [router]); }, [router]);
const handleMobileMenuClose = () => { const handleMobileMenuClose = () => {
...@@ -325,6 +326,7 @@ function Navbar(props) { ...@@ -325,6 +326,7 @@ function Navbar(props) {
className="hover:border border-gray-300 hover:border-solid rounded duration-200" className="hover:border border-gray-300 hover:border-solid rounded duration-200"
placeholder="ค้นหา…" placeholder="ค้นหา…"
inputProps={{ "aria-label": "search" }} inputProps={{ "aria-label": "search" }}
value={search}
onChange={(e) => { onChange={(e) => {
return onUpdateSearch(e.target.value); return onUpdateSearch(e.target.value);
}} }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment