Skip to content

Instantly share code, notes, and snippets.

@Kristian-Roopnarine
Created February 18, 2020 17:09
Show Gist options
  • Save Kristian-Roopnarine/ab320f4516aac6f9741bab1f0ac74da7 to your computer and use it in GitHub Desktop.
Save Kristian-Roopnarine/ab320f4516aac6f9741bab1f0ac74da7 to your computer and use it in GitHub Desktop.
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