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

238
Views
React.js - 2 x ant design sliders retrieve data for both values rather than individual

The two sliders when activated in the browser work together rather than individual. Console log shows both requests, no matter which slider I'm using. Backend works fine and if I comment one slider out, the remaining slider works fine. Can anyone see where I am going wrong please?

// const

const [load, setLoad] = useState([0, 16]);
const [freq, setFreq] = useState([0, 28]);

// load items for slider 1

useEffect(() => {
console.log("ok to request load");
fetchProducts({ load });
}, [ok]);

// slider 1

const handleSliderLoad = (valueLoad) => {
setLoad(valueLoad);
setTimeout(() => {
  setOk(!ok);
}, 300);

};

// load items for slider 2

useEffect(() => {
console.log("ok to request freq");
fetchProducts({ freq });
}, [ok]);

// slider 2

const handleSliderFreq = (valueFreq) => {
setFreq(valueFreq);
setTimeout(() => {
  setOk(!ok);
}, 300);

};

// html for slider 1

<SubMenu
          key="2"
          title={
            <span>
              <p className="pt-4">
                Load Bearing MN/m<sup>2</sup>
              </p>
            </span>
          }
        >
          <div>
            <Slider
              className="ml-4 mr-4"
              tipFormatter={(v) => v}
              range
              value={load}
              onChange={handleSliderLoad}
              max="16"
              // range defaultValue={[0, 16]}
            />
          </div>
        </SubMenu>

// html for slider 2

<SubMenu
          key="3"
          title={
            <span>
              <p className="pt-4">
                Natural Frequency Hz
              </p>
            </span>
          }
        >
          <div>
            <Slider
              className="ml-4 mr-4"
              tipFormatter={(v) => v}
              range
              value={freq}
              onChange={handleSliderFreq}
              max="28"
              // range defaultValue={[0, 16]}
            />
          </div>
        </SubMenu>
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!