File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
8383export default Projects ;
8484
85- type MouseEventHandler = ( event : React . MouseEvent < HTMLButtonElement > ) => void ;
85+ type MouseEventHandler = ( ) => void ;
8686
8787export 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+
You can’t perform that action at this time.
0 commit comments