12

I can't use Javascript object destrucuring in react components because a colleague doesn't like / understand it for some reason.

So instead of:
({ something }) => {
return (
<div>{something}</div>
)
}

If have to use
(props) => {
return (
<div>{props.something}</div>
)
}

Its no big issue, but I hate it.

Comments
  • 5
    Has he come across an "import { this } from 'that';" statement yet? That'll be sure to trigger him. Lol
  • 1
    Now that's just sad 😔
    Redux's reducers ought to be ugly as well...
  • 3
    Wear his skin as a suit so that he can watch you use destructuring 👍
  • 1
    But like.
    Why do you care?
    He should fucking learn.
  • 2
    Your coworker is an idiot and should read the fucking manual.
  • 1
    One benefit of using props is: when you convert your file into typescript, it’s easier to attach interface into it 🤔
  • 1
    @sunfishcc how so? Typescript supports destructuring just as much
  • 0
    @Commodore I mean easy to add interface to your code with minimal line changes.
    Eg:
    (props: IMyComponentProps) => ...

    interface IMyComponentProps {
    id: number;
    ...
    }
Add Comment