Skip to content

Commit 39dcadf

Browse files
committed
fixed programme issue
1 parent dca1f13 commit 39dcadf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/pages/Programme.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ import { useParams } from 'react-router-dom';
44
import useFetch from '../hooks/useFetch';
55

66
function Programme() {
7-
87
const dept = useParams()?.dept;
9-
const Programs = useFetch(`/dept/${dept}/programmeInfo`).data;
10-
118
const [programInfo, setProgramInfo] = useState({});
9+
const Programs = useFetch(`/dept/${dept}/programmeInfo`).data;
1210

1311
const handlescroll = (id) => {
1412
let str = "#" + id;
@@ -18,7 +16,8 @@ function Programme() {
1816
}
1917
useEffect(() => {
2018
window.scroll(0, 0);
21-
}, [])
19+
setProgramInfo(Programs[0])
20+
}, [Programs])
2221
const departments = {
2322
"it": "Information Technology",
2423
"cse": "Computer Science and Engineering",
@@ -37,7 +36,9 @@ function Programme() {
3736
"cy": "Chemistry",
3837
'cee':'Center for Energy and Environment','cai':'Center for Artificial Intelligence',
3938
}
39+
4040
return (
41+
4142
<>
4243
<div className="text-gray-600 body-font w-full h-full">
4344
<div className="container flex flex-col px-5 py-12 mx-auto" style={{ height: "100%" }}>

0 commit comments

Comments
 (0)