Skip to content

Commit 7d9c869

Browse files
authored
[IMP] Remove use of useMemo, since setting the animation string is not computationally complex, and the whole component is memoized by svgr. (#6)
1 parent 934c914 commit 7d9c869

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

templates/svg.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const propTypesTemplate = (
33
{ tpl }
44
) => {
55
return tpl`import '../style.css';
6-
import { memo, useMemo } from 'react';
6+
import { memo } from 'react';
77
import { IonIconProps } from '../types';
88
${interfaces}
99
@@ -14,18 +14,7 @@ function ${componentName}({
1414
beat,
1515
...props
1616
}: IonIconProps) {
17-
const animation = useMemo(() => {
18-
if (spin) {
19-
return 'spin';
20-
}
21-
22-
if (beat) {
23-
return 'beat';
24-
}
25-
26-
return '';
27-
}, [spin]);
28-
17+
const animation = (spin && 'spin') || (beat && 'beat');
2918
return ${jsx};
3019
}
3120

0 commit comments

Comments
 (0)