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

110
Views
How do I change a gif in react with a continious running loop?

I am trying to change the state of an animated a character on a website running in react. The character animations are stored in GIF files and I would like to be able to change the animation based upon user actions. I am thinking of implementing a continuous running loop that checks certain states to play the correct animation.

Does react offer this functionality? Or what would be the optimal way of doing this?

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

0

You can render a gif state (of the current animation), then update the state based on the users actions:

this.setState({gif: <url_to_gif>}) if using a class component

or const [GIF, setGIF] = useState(''); then setGIF(<url_to_gif>) if using hooks/function component

Place the code to set the gif wherever you are checking for a user action

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!