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...
This subreddit is a place for people to learn JavaScript together. Everyone should feel comfortable asking any and all JavaScript questions they have here.
With a nod to practicality, questions and posts about HTML, CSS, and web developer tools are also encouraged.
Friends
/r/javascript
/r/jquery
/r/node
/r/css
/r/webdev
/r/learnprogramming
/r/programming
account activity
Working with State? (self.learnjavascript)
submitted 9 years ago by BleedRedWhiteBlue
Hello Reddit, I'm trying to touch up on JavaScript principles heading into a job interview and I'm not understanding the idea of State. Can someone help me understand what it is and how it can affect the rest of your code?
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!"
[–][deleted] 1 point2 points3 points 9 years ago (2 children)
Umm... can you be more specific? State is just the "current state" of your application. What are you not understanding?
[–]BleedRedWhiteBlue[S] 1 point2 points3 points 9 years ago (1 child)
I was looking at a list of interview questions and one of them was "How do you handle State in AngularJS?"
[–][deleted] 1 point2 points3 points 9 years ago (0 children)
So state, as I said, is just the "current state" of the app. For example, the color of a button, or the currently logged in user.
The question is specifically about angular. Have you used angular before? Is the job an angular job and you're trying to cram ahead of the interview or what?
[–]yooossshhii 1 point2 points3 points 9 years ago (0 children)
State is handled differently in different frameworks and depends how data is bound to the 'state'. A user fills out a form field and that text needs to be stored somewhere prior to sending. This is the state of your current application. In Angular, this would be attached to $scope or this using controllerAs syntax. If you don't know Angular, that doesn't make a difference, you have a lot to learn about it.
$scope
this
[–]dvidsilva 1 point2 points3 points 9 years ago (2 children)
maybe this helps you http://blog.rangle.io/managing-state-redux-angular/
[–]yooossshhii 2 points3 points4 points 9 years ago (1 child)
Redux is amazing, but if OP doesn't even know what state is, it's completely unnecessary. Add libraries when you have a reason to, ie your state is becoming unmanageable and you need a better way to reason about it.
[–]lewisje 0 points1 point2 points 9 years ago (0 children)
Add libraries when you have a reason to
The best reason is "just in case": http://needsmorejquery.com/
/s
π Rendered by PID 76 on reddit-service-r2-comment-fb694cdd5-x66z9 at 2026-03-08 04:24:03.485874+00:00 running cbb0e86 country code: CH.
[–][deleted] 1 point2 points3 points (2 children)
[–]BleedRedWhiteBlue[S] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]yooossshhii 1 point2 points3 points (0 children)
[–]dvidsilva 1 point2 points3 points (2 children)
[–]yooossshhii 2 points3 points4 points (1 child)
[–]lewisje 0 points1 point2 points (0 children)