Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
TSparticles React render particles only inside component

I have a React component and I want to render the particles only inside that component. I do not want to use the particles as background to the whole page, but inside only that component (div element), as can be seen on dogecoin.com. However I am having serious troubles doing this. The code I use is as follows:

const Block = () => {
const  particlesContainer= useRef(null);

return (
    <MiddleBlockSection>
       <Particles container= {particlesContainer} options={particlesOptions as ISourceOptions}/>
      <ParticlesContainer ref={particlesContainer} id="particles-js"></ParticlesContainer>
      <Slide direction="up" duration={500}>
      
        <Row justify="center" align="middle">
          <ContentWrapper>
            <Col lg={24} md={24} sm={24} xs={24}>
              <h6>{t(title)}</h6>
            </Col>
          </ContentWrapper>
        </Row>
      </Slide>
    </MiddleBlockSection>
  );}

So what I do is that I basically create a ref for the container and try to use it as a ref for particlesjs.

Part of the code where this happens:

<Particles container= {particlesContainer}

I also tried to put the component inside , in pseudocode like this:

<ParticlesContainer> <Particles/> </ParticlesContainer> 

But that does not work as well. The particles still render on the background of the whole page and I wanted it to render only inside the container component.

The npm package I am using is react-tsparticles.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This question was asked in the repository two days ago here.

To disable particles full screen feature you just need to disable it in the options like this:

{
    fullScreen: { enable: false }
    /* all other options */
} 
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!