выводит пустой экран
import React,{useState,useRef,useEffect} from 'react';
function Polzunok() {
const pstart= useRef(1);
const ppend= useRef(15000);
const [pstartValue, setPstartValue] = useState(1);
const [ppendValue, setPpendValue] = useState(15000);
const [lastActive, setLastActive] = useState(0);
function checkError( a, b, c){
if(c==1){
if(a>b){
a=b-100;
}else if(a<b){
console.log("this a < b");
}
}else if(c==2){
if(a>b){
b=a+100;
}else if(a<b){
console.log("a < this b");
}
}else{
console.log("else");
}
}
useEffect(() => {
pstart.current.addEventListener('change', e => {
setLastActive(1);
setPstartValue(e.target.value);
})
ppend.current.addEventListener('change', e => {
setLastActive(2);
setPpendValue(e.target.value);
})
lastActive.addEventListener('change',checkError( pstartValue, ppendValue,lastActive));
}, []);
return (
<div className="container">
<h5 className="polzName">Название</h5><br/>
<div className="slider"></div>
<div>
<input type="range" ref={pstart} className="pp" min="0" max="16000"/>
<input type="range" ref={ppend} className="pp" min="0" max="16000"/>
</div>
<div><p>"start" {pstartValue} "end" {ppendValue}<br/>"lastActive":{lastActive}</p></div>
</div>
);
}
export default Polzunok;