feat: Update active tutorial state initialization

Update the initialization of the activeTutorial state in the Tutorials component to set it to 8 instead of 2. This ensures that the correct tutorial is displayed when the category ID changes. Removed an empty useEffect hook that was no longer needed.
This commit is contained in:
ALi Josheghani
2024-10-16 14:14:28 +03:30
parent 5c0831f5ef
commit 4d74a723b1

View File

@@ -16,12 +16,12 @@ const Tutorials = () => {
}); });
const { id } = useSelector((state: RootState) => state.categoryIdState); const { id } = useSelector((state: RootState) => state.categoryIdState);
const [activeTutorial, setActiveTutorial] = useState<number>(2); const [activeTutorial, setActiveTutorial] = useState<number>(8);
useEffect(() => { useEffect(() => {
if (id !== 0) setActiveTutorial(id); if (id !== 0) setActiveTutorial(id);
}, [id]); }, [id]);
useEffect(() => {}, []);
return ( return (
<div className="relative w-full h-full flex flex-col px-4 py-4 text-start"> <div className="relative w-full h-full flex flex-col px-4 py-4 text-start">
<h1 className="font-bold text-xl md:text-2xl text-center">آموزش</h1> <h1 className="font-bold text-xl md:text-2xl text-center">آموزش</h1>