What is the difference between calling object Obj, directly in es6 and {.Obj}.

see such a way to write, such as introducing an object Obj, and then assigning gConfig to that object. The code is as follows

// Setting.js
export default {
    type:4,
    city:3,
    doman:".baidu.com"
    ip:"10.40.3.20"
}

// Config.js
import Settings from "./Setting"
const myConfig = {
    gConfig:{...Settings}  //
}
What is the difference between

gConfig: {.Settings} and gConfig:Settings? Ask for advice ~

Mar.23,2021

first, myConfig.gConfig = Settings is false
second, myConfig.gConfig = Settings is true

the first one is generally used to avoid affecting Settings

when making changes to myConfig.gConfig .

suppose setting= {key:1};
the first gConfig= {key:1}
the second gConfig= {setting: {key:1}

Menu