Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react destructuring with rename

// To destructure //
const { nextId, taskName, doBefore } = this.state;
console.log(nextId, taskName, doBefore)

// To destructure and rename //
const { nextId: id, taskName: name, doBefore } = this.state;
console.log(id, name, doBefore)
// ("nextId" and "taskName" were renamed to "id" and "name")
 
PREVIOUS NEXT
Tagged: #react #destructuring #rename
ADD COMMENT
Topic
Name
1+6 =