Comment by lhnz
4 years ago
Prop destructuring isn't necessary. A lot of people changed to accessing the props via property access and this is often a better approach for conciseness. Don't force yourself to do something stylistic if it doesn't fit!
4 years ago
Prop destructuring isn't necessary. A lot of people changed to accessing the props via property access and this is often a better approach for conciseness. Don't force yourself to do something stylistic if it doesn't fit!
Thanks for weighing in, that's good to know. After wondering if this could be auto-refactored, I came across https://github.com/jsx-eslint/eslint-plugin-react/blob/maste..., will definitely have to give that (with `--fix`) a try in the new year and see if I can get the team on board! – desire for typescript being a compelling factor.
Personally I do like the non-destructured `props.abc` throughout component code, really helps clarify at a glance where something is coming from, whether it's locally or externally defined, etc. Code style is an endless exercise in compromises/opinions though, even _with_ tools like eslint and prettier.
One thing I'll add about `props.propertyAccess` over destructuring is that with TypeScript and a good IDE it gives you autocompletion.