Skip to content

Commit c05d16e

Browse files
committed
build: improving react demo
1 parent 009f310 commit c05d16e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apps/react/src/App.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ import "./App.css";
77
function App() {
88
const containerRef = useRef(null);
99
const [init, setInit] = useState(false);
10-
11-
useParticlesPlugins(async (engine) => {
10+
const { done, error } = useParticlesPlugins(async (engine) => {
1211
await loadFull(engine);
13-
}).then(() => {
14-
setInit(true);
1512
});
1613

14+
console.log({ error, done, init });
15+
16+
if ((!error && !done) || !init) {
17+
setInit(done);
18+
}
19+
1720
const particlesLoaded = useCallback(
1821
(container) => {
1922
containerRef.current = container;

0 commit comments

Comments
 (0)