Skip to content

Commit c4ee76e

Browse files
committed
build: missing updates
1 parent 7e720e6 commit c4ee76e

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

components/react-new/lib/Particles.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,26 @@ import type { IParticlesProps } from "./IParticlesProps";
33
import { tsParticles, type Container } from "@tsparticles/engine";
44

55
function Particles(props: IParticlesProps): JSX.Element {
6-
const id = props.id ?? "tsparticles";
7-
const [container, setContainer] = React.useState<Container | undefined>(undefined);
6+
const id = props.id ?? "tsparticles";
7+
const [container, setContainer] = React.useState<Container | undefined>(
8+
undefined
9+
);
810

9-
useEffect(() => {
10-
tsParticles.load({ id, url: props.url, options: props.options }).then(c => {
11-
setContainer(c);
11+
useEffect(() => {
12+
tsParticles
13+
.load({ id, url: props.url, options: props.options })
14+
.then((c) => {
15+
setContainer(c);
1216

13-
props.particlesLoaded?.(c);
14-
});
17+
props.particlesLoaded?.(c);
18+
});
1519

16-
return () => {
17-
container?.destroy();
18-
};
19-
}, [id, props.url, props.options]);
20+
return () => {
21+
container?.destroy();
22+
};
23+
}, [id, container, props, props.url, props.options]);
2024

21-
return <div id={id} className={props.className}></div>;
25+
return <div id={id} className={props.className}></div>;
2226
}
2327

2428
export default Particles;

0 commit comments

Comments
 (0)