I Create Guttenberg pluggin by react. My problem is that I cannot use if statement.
const priceforextrashop = parseFloat(props.priceextra)
const priceforegoodshop = parseFloat(props.pricegoood)
const priceforstandardshop = parseFloat(props.pricestandard)
const priceforsmallshop = parseFloat(props.pricesmall)
React.useEffect(() => {
if(wynik<20000){
setPrice(priceforextrashop);
}
if(wynik<15000){
setPrice(priceforegoodshop);
}
if(wynik<10000){
setPrice(priceforstandardshop);
}
if(wynik<5000){
setPrice(priceforsmallshop);
}
}, [][wynik]);
props.prices reffer to attritubutes I add on editor-block side of plugin. The value work good, I exposed them on screen. problem is just with these if statement because always show the same value. I know that the if statement should work good because on editor-black side or in another scripts, I put the same if statement and it worked. Please indicate me answer.
update:
I add dependence "wynik" but it not resolve my problem. Just count 2from 4 variables not all of them. I try without useEffect but then it make an error.