React, using spread operator with a function parameter to update state?

what 'm trying to achieve is this function :

     const handleButtonState = (command) => {
          const obj = buttonState
          obj[command] = !obj[command]  
            setButtonState(obj)
      }

Using the spread operator method on the state something like this:

const handleButtonState = (command) => {
            setButtonState({...buttonState , [command]:![command] })
      }

is this possible?