While using material ui, I realized they have a prop called in in the transitions components, but when trying to destruct the props, I can't because in is a reserved key word.
const MyFade = ({ children, in, ...otherProps }) => { // this gives me an error
return (
<div {...otherProps}>
<Fade in={in}>{children}</Fade>
</div>
);
};
How can I do this? I need to destruct in and have otherProps to spread in the div.
Just assign a new, not reserved name inside destructuring.
const o = {
in: 'foo',
out: 'boo',
};
const { in: inProp } = o;
// ^^^^ assign new name
console.log(inProp);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With