Created
February 18, 2020 17:09
-
-
Save Kristian-Roopnarine/ab320f4516aac6f9741bab1f0ac74da7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useState,useEffect} from 'react' | |
import ProjectCard from './ProjectCard' | |
import projects from '../apis/projects' | |
const Projects = () => { | |
const [projectInfo,setProjectInfo] = useState([]); | |
const fetchProjects = async () =>{ | |
const response = await projects.get('/projects/') | |
setProjectInfo(response.data) | |
} | |
useEffect(()=>{ | |
fetchProjects() | |
},[]) | |
return ( | |
<> | |
<div className="ui center aligned container"> | |
<h1>Projects</h1> | |
<h2>{projectInfo.length}</h2> | |
{console.log(projectInfo)} | |
</div> | |
<div className="ui three raised cards"> | |
<ProjectCard /> | |
<ProjectCard /> | |
<ProjectCard /> | |
<ProjectCard /> | |
<ProjectCard /> | |
<ProjectCard /> | |
</div> | |
</> | |
) | |
} | |
export default Projects |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment