Spread syntax ES6 with statement

后端 未结 1 1238
南笙
南笙 2020-12-19 23:23

I tried to write ternary operator with spread syntax and copy two objects. Is it possible to use ternary operator with spread syntax inside with literal objects? My code wo

相关标签:
1条回答
  • 2020-12-19 23:31

    Spread is not an operator, it's part of the object literal syntax (or at least it will be when the proposal is accepted). You need to write

    {...globalStyles.hint, ...(disabled ? globalStyles.hintDisabled : {})},
    
    0 讨论(0)
提交回复
热议问题