The react dynamic setting disabled property does not take effect in Safari

render(){
     var disabled=false;
     
     !this.state.beginTime?(disabled=true):(disabled=false) 
     
     return <button disabled={disabled}></button>
}

according to the change of beginTime, set the diasbled property dynamically
this code works well in chrome and Firefox, but it doesn"t work and doesn"t report an error in Safari. The version of Safari is 11.1.2.

May.25,2021

What do you mean

doesn't work? Does it have a value of false, or a value of true but no disabled effect?

in addition, your code is not very good, you can write it like this:

render(){
     <button disabled={!this.state.beginTime}></button>
}
Don't you need return in

render?


the problem has been solved.
there is no problem with this way of writing, but the time format processed by new Date is not compatible in safari, so the relevant value is always undefined, so the disabled attribute does not take effect.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34189-40473.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34189-40473.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?