diff --git a/src/components/students-in-categories/StudentsInCategories.tsx b/src/components/students-in-categories/StudentsInCategories.tsx index 78b6f6de3..663794586 100644 --- a/src/components/students-in-categories/StudentsInCategories.tsx +++ b/src/components/students-in-categories/StudentsInCategories.tsx @@ -5,9 +5,20 @@ import EventIcon from '@mui/icons-material/Event' import StudentsInCategoriesChart from './StudentsInCategoriesChart' import { useTranslation } from 'react-i18next' import { selectedCategory, years } from './StudentsInCategories.constants' +import { useCallback } from 'react' function StudentsInCategories() { const { t } = useTranslation() + + const selectOption = useCallback( + (options: { value: number | string }[]) => + options.map((option) => ( + + {option.value} + + )), + [] + ) return ( @@ -27,11 +38,7 @@ function StudentsInCategories() { )} sx={styles.select} > - {selectedCategory.map((option) => ( - - {option.value} - - ))} + {selectOption(selectedCategory)} +