import { useCallback, useEffect, useState } from 'react';
interface CurrentWorkplace {
company: string;
position: string;
}
interface AboutMeState {
currentWorkplace: Partial<CurrentWorkplace>;
dailyKnowledge: string[];
fullName: string;
}
interface AboutMeHook {
aboutMe: AboutMeState;
}
export default function useAboutMe(): AboutMeHook {
const [aboutMe, setAboutMe] = useState<AboutMeState>({
currentWorkplace: {},
dailyKnowledge: [],
fullName: ''
});
const setFullName = useCallback(() => {
setAboutMe({
...aboutMe,
fullName: 'Andriannus Parasian'
});
}, [aboutMe]);
const setCurrentWorkplace = useCallback(() => {
setAboutMe({
...aboutMe,
currentWorkplace: {
company: 'eFishery',
position: 'Frontend Engineer'
}
});
}, [aboutMe]);
const setDailyKnowledge = useCallback(() => {
setAboutMe({
...aboutMe,
dailyKnowledge: [
'JavaScript',
'TypeScript',
'React.js',
'Vue',
'Angular',
'AJAX',
'CSS Preprocessor',
'Unit Test',
'E2E Test',
'Git',
'JIRA/ClickUp'
]
});
}, [aboutMe]);
useEffect(() => {
setFullName();
setDailyKnowledge();
setCurrentWorkplace();
}, [setFullName, setDailyKnowledge, setCurrentWorkplace]);
return { aboutMe };
}
andriannus / kepobro-news Goto Github PK
View Code? Open in Web Editor NEWPersonal news portal. Powered by News API
Home Page: https://kepobro-news.herokuapp.com/