docs: add JSDoc to useDebounce hook
This commit is contained in:
@@ -7,6 +7,10 @@ import Categories from "./pages/Categories";
|
||||
import About from "./pages/About";
|
||||
import Recommend from "./pages/Recommend";
|
||||
|
||||
/**
|
||||
* Main application router.
|
||||
* Renders layout with Navbar/Footer and routes to pages.
|
||||
*/
|
||||
export default function App() {
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -9,6 +9,9 @@ const NAV_LINKS = [
|
||||
{ label: "About", to: "/about" },
|
||||
];
|
||||
|
||||
/**
|
||||
* Site navigation bar with responsive menu.
|
||||
*/
|
||||
export default function Navbar() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const { pathname } = useLocation();
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
/**
|
||||
* Debounces a value to delay updates (e.g., for search input).
|
||||
* @param {any} value - The value to debounce.
|
||||
* @param {number} delay - Delay in ms (default 300).
|
||||
* @returns {any} The debounced value.
|
||||
*/
|
||||
export function useDebounce(value, delay = 300) {
|
||||
const [debounced, setDebounced] = useState(value);
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user