Yes, you can rename destructured props in JavaScript. When destructuring an object, you can use a colon (:) to assign a new variable name to a property. Here's an example:
const user = {
name: 'John Doe',
age: 30,
email: 'john@example.com'
};
// Destructuring with renaming
const { name: userName, age: userAge } = user;
console.log(userName); // Output: John Doe
console.log(userAge); // Output: 30
In this example, the name property is renamed to userName, and the age property is renamed to userAge during destructuring. This allows you to use the new variable names in your code.
