How to understand the object deconstruction assignment of ES6?

ES6 Code

const a = {
    action:({commit}) => {
        commit("action")
    }
}

question: how to understand {commit} here?

Oct.19,2021

 

"ES6 allows to extract values from arrays and objects and assign values to variables according to a certain pattern, which is called deconstruction."
this is what you mean by commit .

but, what you have here has nothing to do with structure assignment. Your commit is a parameter passing object in an arrow function.

Menu