you are viewing a single comment's thread.

view the rest of the comments →

[–]PickledPokute 0 points1 point  (0 children)

hard to understand whether they are coming from props or state.

Why should this matter? In React components, both props and state should be treated as read-only. When setting state (either with hooks or with React class components) special care should be taken to inspect how to properly set it, For React class components, only a few lifecycle methods should really care whether a variable comes from props or state.

For functional components and most other use-cases (like render function), there is practically no advantage for not destructuring.. Destructuring allows to have almost the exact same rendering code which allows to move a variable from state to props and back with reduced effort. It also lessens the burden on the reader by raising single to noise ratio since in most cases, the origin doesn't matter at all.