I'm trying to remove a dynamic property from myObject (in a react project). Here is myObject:
myObject = {
'property1': {},
'property2': {},
'3': {}
}
This is what I tried:
const {[prop]:removedItem, ... rest} = myObject;
the problem is that it doesn't work when prop = '3' ,it works when prop = 'property1' though.
Any ideas where I'm making a mistake?