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

180
Views
React State Hook, state not updating

I have some text that I want to simply highlight using a simple react package called 'react-animarker'. I have tried to use useState hook as I want to dynamically update the speed of the animation as shown. However, the duration does not change the way I want it to. But in the console, it does show as changing. Any ideas as to why?

Link to React Package: https://github.com/ramonmetzker/react-animarker

import React, {useState} from 'react'
import {Mark} from 'react-animarker'


const Highlightx = () => {

    const [speed, setSpeed] = useState(5)

    const handleClick = () => {
        setSpeed(20)
        console.log(speed);
    }  

  return (
    <>
    <Mark duration={speed}>Highlightx</Mark>
    <button onClick={handleClick}>Hello</button>
    </>
  )
}

export default Highlightx

about 4 years ago · Juan Pablo Isaza
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!