Refactored- Avoiding modifying the prop

This commit is contained in:
Aadhar Chandiwala
2022-03-18 06:18:17 +05:30
parent dac4e862b8
commit e4950728d8

View File

@ -19,10 +19,7 @@ const Theme = () => {
const { background, text, primary } = useAppSelector<ThemeType>((state) => get(state.resume, 'metadata.theme'));
const handleChange = (property: string, color: string) => {
if (color[0] !== '#') {
color = `#${color}`;
}
dispatch(setResumeState({ path: `metadata.theme.${property}`, value: color }));
dispatch(setResumeState({ path: `metadata.theme.${property}`, value: color[0] !== '#' ? `#${color}` : color }));
};
return (