Which writing method is better judged by if?

which is better to write the following code:
method 1:

if(show){
    drawercStyle = {
        width: 100%
    }
    maskStyle = {
        opacity: 1
    }
}
else{
    drawercStyle = {
        width: 0
    }
    maskStyle = {
        opacity: 0
    }
}
Oct.11,2021

if I wrote it

  

Ternary operators do not need parentheses

Menu