Skip to content

Commit cd1048b

Browse files
authored
Merge pull request #8 from Killercavin/repo-fix
Repo fix [Projects.tsx]
2 parents 359eb99 + e75ae16 commit cd1048b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

components/projects/Projects.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ const Projects = ({ projectsData }: Props) => {
2020
const [filteredProjects, setFilteredProjects] = useState<project[]>(projects);
2121
const [viewAll, setViewAll] = useState(false);
2222

23-
const filterProjects = (cat: string) => {
23+
const filterProjects = useCallback((cat: string) => {
2424
setViewAll(false);
2525
setCategory(cat);
2626
setFilteredProjects(
2727
projects.filter((p) => p.category.toLowerCase() === cat.toLowerCase())
2828
);
29-
};
29+
}, [projects]);
3030

3131
useEffect(() => {
3232
if (categories.includes("MERN Stack")) {
3333
filterProjects("MERN Stack");
3434
} else {
3535
filterProjects(categories[0] || "");
3636
}
37-
}, [categories]);
37+
}, [categories, filterProjects]);
3838

3939
return (
4040
<SectionWrapper id="projects" className="mx-4 md:mx-0 min-h-screen">
@@ -82,7 +82,7 @@ const Projects = ({ projectsData }: Props) => {
8282

8383
export default Projects;
8484

85-
type MouseEventHandler = (event: React.MouseEvent<HTMLButtonElement>) => void;
85+
type MouseEventHandler = () => void;
8686

8787
export const ViewAll = ({
8888
handleClick,
@@ -118,3 +118,6 @@ export const ViewAll = ({
118118
</div>
119119
</>
120120
);
121+
import { useCallback } from "react";
122+
// Remove the incorrect useCallback implementation
123+

0 commit comments

Comments
 (0)