Inline tab option selection function

This commit is contained in:
Leonardo Murça 2022-08-11 19:20:42 -03:00
parent af6a4ebeaa
commit 49163a9d7f

View file

@ -20,10 +20,6 @@ function Classroom() {
const [tabData, setTabData] = useState(TAB_OPTIONS.announcements); const [tabData, setTabData] = useState(TAB_OPTIONS.announcements);
const onSelectTabOption = (_, value) => {
setSelectedTabOption(value);
};
const fetchAndPopulateAnnouncementsTabData = useCallback(async () => { const fetchAndPopulateAnnouncementsTabData = useCallback(async () => {
const announcements = await fetchClassroomAnnouncements(params.id); const announcements = await fetchClassroomAnnouncements(params.id);
const upcomingAssignments = await fetchUpcomingAssignments(params.id); const upcomingAssignments = await fetchUpcomingAssignments(params.id);
@ -71,7 +67,7 @@ function Classroom() {
layoutType={layoutType} layoutType={layoutType}
classroom={classroom} classroom={classroom}
selectedTabOption={selectedTabOption} selectedTabOption={selectedTabOption}
onSelectTabOption={onSelectTabOption} onSelectTabOption={(_, value) => setSelectedTabOption(value)}
announcementsTabData={ announcementsTabData={
tabData && tabData.tab === 'announcements' ? tabData : null tabData && tabData.tab === 'announcements' ? tabData : null
} }