mirror of
https://github.com/iconify/iconify.git
synced 2024-12-05 02:33:16 +00:00
chore(react): prevent rerendering on mount with ssr attr
This commit is contained in:
parent
e244ddea3d
commit
61a5383f46
@ -2,7 +2,7 @@
|
||||
"name": "@iconify/react",
|
||||
"description": "Iconify icon component for React.",
|
||||
"author": "Vjacheslav Trushkin",
|
||||
"version": "5.0.0-beta.1",
|
||||
"version": "5.0.0-beta.2",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"tag": "next"
|
||||
|
@ -288,16 +288,15 @@ function IconComponent(props: InternalIconProps): JSX.Element {
|
||||
// Mounted state, cleanup for loader
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
updateState();
|
||||
return cleanup;
|
||||
}, []);
|
||||
|
||||
// Icon changed
|
||||
// Icon changed or component mounted
|
||||
useEffect(() => {
|
||||
if (mounted) {
|
||||
updateState();
|
||||
}
|
||||
}, [props.icon]);
|
||||
}, [props.icon, mounted]);
|
||||
|
||||
// Render icon
|
||||
const { name, data } = state;
|
||||
|
Loading…
Reference in New Issue
Block a user