assignment operator - I don't understand what's going on this syntax javascript -
how gonna assign in const { types, creators }
in below code mean types gonna hold , creators gonna hold.
const { types, creators } = createactions({ userrequest: ['username'], usersuccess: ['avatar'], userfailure: null }) var createactions = (function (config, options) { if (r.isnil(config)) { throw new error('an object required setup types , creators'); } if (r.isempty(config)) { throw new error('empty objects not supported'); } return { types: converttotypes(config, options), creators: converttocreators(config, options) }; })
the syntax object destructuring assignment. types
, creators
defined types
, creators
properties returned object returned @ createactions()
call. example
const {types, creators} = (() => { return {types:0, creators:1} })(); console.log(types, creators)
Comments
Post a Comment