spread operator in react throwing error of Unexpected token

前端 未结 3 576
甜味超标
甜味超标 2020-12-09 16:59

Here is the code where I have included spread operator

style={{ ...styles.detailsRow.icon, alignSelf: \'centre\' }}


What things d

3条回答
  •  时光说笑
    2020-12-09 17:34

    You are missing one babel preset, stage-0

    npm install --save-dev babel-preset-stage-0
    

    if you have .bablerc file add following to it.

    {
      "presets":[
        "es2015", "react", "stage-0"
      ]
    }
    

    Or added to webpack config in loader.

提交回复
热议问题