-
diff --git a/src/components/CourseTable.js b/src/components/CourseTable.js
index 1bf4420..f7ad7e7 100644
--- a/src/components/CourseTable.js
+++ b/src/components/CourseTable.js
@@ -5,6 +5,7 @@ import CircleSpinner from './Utilities/Loaders/CircleSpinner';
export default function CourseTable({id,title,online,start_date,end_date,imagePath,duration}){
const url = 'https://chain-legendary-strawflower.glitch.me/courses';
const [courses,setCourses]= useState([]);
+ const [allCourses,setAllCourses]=useState(null);
const fetchLastCourses = () =>{
fetch(url,{
@@ -15,6 +16,7 @@ export default function CourseTable({id,title,online,start_date,end_date,imagePa
}})
.then((response)=> response.json())
.then((data)=> {
+ setAllCourses(data.length);
const lastCourses = data.slice(-5);
setCourses(lastCourses);});
}
@@ -51,13 +53,11 @@ export default function CourseTable({id,title,online,start_date,end_date,imagePa
{courses.length > 0 && courses.map((item) =>{
- return ()
- }
-
- )}
+ return ()
+ })}
+
Total number of courses: {allCourses}
>
-
)
}
\ No newline at end of file