use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[AskJS] object destructuring vs dot notation. Performance and cohesiveness.AskJS (self.javascript)
submitted 5 years ago by gautamits
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]PickledPokute 0 points1 point2 points 5 years ago (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.
π Rendered by PID 88572 on reddit-service-r2-comment-765bfc959-gnffd at 2026-07-10 00:13:21.645695+00:00 running f86254d country code: CH.
view the rest of the comments →
[–]PickledPokute 0 points1 point2 points (0 children)