Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is not working w/ react-router@latest template. #133

Open
GameLord2011 opened this issue Dec 20, 2024 · 0 comments
Open

Is not working w/ react-router@latest template. #133

GameLord2011 opened this issue Dec 20, 2024 · 0 comments

Comments

@GameLord2011
Copy link

I am using the following code:

import { useEffect, useMemo, useState } from "react"; 
import Particles, { initParticlesEngine } from "@tsparticles/react"; 
import { 
  type Container, 
  type ISourceOptions, 
  MoveDirection, 
  OutMode, 
} from "@tsparticles/engine"; 
import { loadAll } from "@tsparticles/all"; 

for the imports

const App = () => { 
  const [init, setInit] = useState(false); 

  // this should be run only once per application lifetime 
  useEffect(() => { 
    initParticlesEngine(async (engine) => { 
      // you can initiate the tsParticles instance (engine) here, adding custom shapes or presets 
      // this loads the tsparticles package bundle, it's the easiest method for getting everything ready 
      // starting from v2 you can add only the features you need reducing the bundle size 
      await loadAll(engine); 
      //await loadFull(engine); 
      //await loadSlim(engine); 
      //await loadBasic(engine); 
    }).then(() => { 
      setInit(true); 
    }); 
  }, [])}; 
 
  const particlesLoaded = async (container?: Container): Promise<void> => { 
    console.log(container); 
  }; 

for the init,
and:

<Particles 
        id="tsparticles" 
        url="/paritcles.json" 
        particlesLoaded={particlesLoaded} 
      /> 

for the particles, my config is in /public/particles.json. The particles seem to be initializing, but there are no errors, or particles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant