Merge pull request #1 from kshitij-ka/Atharva

docs: add JSDoc to useDebounce hook
This commit is contained in:
K
2026-05-02 13:05:08 +05:30
committed by GitHub
3 changed files with 13 additions and 0 deletions
+4
View File
@@ -7,6 +7,10 @@ import Categories from "./pages/Categories";
import About from "./pages/About"; import About from "./pages/About";
import Recommend from "./pages/Recommend"; import Recommend from "./pages/Recommend";
/**
* Main application router.
* Renders layout with Navbar/Footer and routes to pages.
*/
export default function App() { export default function App() {
return ( return (
<> <>
+3
View File
@@ -9,6 +9,9 @@ const NAV_LINKS = [
{ label: "About", to: "/about" }, { label: "About", to: "/about" },
]; ];
/**
* Site navigation bar with responsive menu.
*/
export default function Navbar() { export default function Navbar() {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const { pathname } = useLocation(); const { pathname } = useLocation();
+6
View File
@@ -1,5 +1,11 @@
import { useState, useEffect } from "react"; 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) { export function useDebounce(value, delay = 300) {
const [debounced, setDebounced] = useState(value); const [debounced, setDebounced] = useState(value);
useEffect(() => { useEffect(() => {