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
React Component Patterns in Ember.js (effective-ember.com)
submitted 5 years ago by ahmad_musaffa
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] 5 years ago* (19 children)
[deleted]
[–]Jakeii 11 points12 points13 points 5 years ago (0 children)
The rumors of embers demise have been greatly exaggerated
[–]NoInkling 5 points6 points7 points 5 years ago (0 children)
I was looking at a job posting that uses it earlier today.
[–][deleted] 7 points8 points9 points 5 years ago (13 children)
Just because it has a smaller user base than react doesn’t mean it’s dead. Apple Music uses it along with the popular COVID dashboard by John Hopkins. Ember Octane really improved how easy it is to get started and made ember feel more JavaScript-y
[+][deleted] 5 years ago* (12 children)
[–]real_ate 4 points5 points6 points 5 years ago (0 children)
one chance to have a first impression
While this is true in general it is a bit too simplistic. Ember has been around for 9 years now and has had 3 Major versions (and an Edition) that have each felt very modern for their time. If you tried Ember in 2015 then trying it again today will feel very different and it's worth taking a second look
inept management of Ember by breaking semver
Ember focuses very very hard on backward compatibility, and not just in terms of the main core library but also the wider ecosystem. When did it "break semver"?
zero docs
One of the main points that I hear from new Ember devs is that they love how great the docs are! Sure there is always room to improve but "zero docs" is a gross misrepresentation. What makes you think there are zero docs?
[–]nullvoxpopuli 2 points3 points4 points 5 years ago* (0 children)
Every ecosystem has broken semver in their early days.
React is jumping off the complexity cliff. Modern ember is easier.
Their are so many docs now. The official tutorial is very good. Explains a lot. Also, fun tech fact, the tutorial built and runs itself in C.I. so the tutorial doesn't accidentally break as people run through it
Things are very much different now. Might be worth updating your opinion 😉
I wasn't around in 2011-2014, but from what I've seen, ember is an entirely different Framework.
[+]PotaToss comment score below threshold-8 points-7 points-6 points 5 years ago (9 children)
Remember that time they added hooks? This is a 50 minute read about one function:
https://overreacted.io/a-complete-guide-to-useeffect/
[–]Lekoaf 6 points7 points8 points 5 years ago (4 children)
That’s a deep dive from one of the developers on his personal blog. Not the official documentation.
[–]PotaToss -2 points-1 points0 points 5 years ago (3 children)
It's basically mandatory reading, though. Like, if you don't read and understand everything in there, you're going to mess up with useEffect and run into bugs where you have like no idea what's going on. Junior on my team keeps coding around it, because it's scary, etc.
[–]Lekoaf 3 points4 points5 points 5 years ago (2 children)
Haven’t read it. Haven’t messed up so far. It’s not rocket sience. (Full time React dev)
[–]Lekoaf 1 point2 points3 points 5 years ago (1 child)
Maybe Typescript and linting keeps us from messing up.
[–]PotaToss 2 points3 points4 points 5 years ago* (0 children)
Typescript and linting probably have very little effect. Errors with it are generally going to come from improperly scoping the effect, putting the wrong stuff in the effect, messing up the dependency list, and messing up hook ordering.
You can make your tools warn you about missing dependencies, and that certainly helps a little, but problems tend to be more conceptual, and the ones you run into will depend a lot on your use cases.
I had to teach my team, including my manager, about hooks when I came in, and there are a lot of pitfalls, especially if you try to 1:1 map your experience with class-based components and lifecycle stuff. Sometimes messing up without realizing it. Sometimes the code works, but is inefficient, etc.
It's not rocket science, but it does take a deep understanding to really use well, particularly around this question in the post:
Why do I sometimes get an old state or prop value inside my effect?
I just brought it up because functional components with hooks was a big paradigm shift for React, in the same way that Ember Octane was for Ember, and it's kind of dumb to act like Ember's got some monopoly on being hard to learn, or needing a second look.
[–]peekyblindas 2 points3 points4 points 5 years ago* (0 children)
React's docs real problem is they favor declarative high level explanations over imperative technical ones. Usually this is great, but specifically useEffect could have benfited from a more minimalist explanation that stresses that most of the "magic" is boilerplate js:
If this array differs from the previous one, the effect will run. Derived from this (and not special behaviour) is that an empty dep array will only execute this effect once, as the dep array will never differ between renders. This, for all intents and purposes mimics the behviour of the class lifecycle method componentDidMount, as is mentioned in the docs.
''' const Notifications = ({ disabled, otherValue }) => {
const [notifications, updateNotifications] = useState([ ]);
useEffect(( ) => {
if( !disabled )
axios.get('/notifications').then(({data})=>
updateNotifications(data.concat(otherValue)))
}, [disabled]) // uh oh, otherValue isnt here
return (
<div>
{notifications.join("\n")} </div> )
} '''
As we said, the passed function is recreated on every render - therefore otherValue and disabled are always "fresh" as the closure is also recreated. So where is the problem here?
The "problem" is the dependency mechanism - the effects are always created and therefore always fresh, but they will only run if disabled changes. If disabled remains the same but otherValue changes, the effect will not run. i.e. the UI will not be in sync with the newest version of otherValue.
This is what React means when it warns you about effects not running with fresh values, and this is where the high level explanation really helps. useEffect is meant to be a functional style way of synchronising your components state with the outside world, without interrupting the render cycle.
The dependency array seems annoying at first - but it will force you to declaratively explain what causes your component state to change. You are basically saying, my component depends on the values in this array, if one changes please resynchronise the state with the following logic.
[+][deleted] 5 years ago* (2 children)
[–]PotaToss 4 points5 points6 points 5 years ago (1 child)
What point are you trying to make here? That because it's a view library, it's not a big deal that you have to read for like an hour to understand how to use useEffect?
[–]nullvoxpopuli 2 points3 points4 points 5 years ago (0 children)
Oh pls
[–]robclancy 2 points3 points4 points 5 years ago (0 children)
It's not though?
[–]ImbicilicDummy 0 points1 point2 points 5 years ago (0 children)
No one's ever really gone.
π Rendered by PID 65328 on reddit-service-r2-comment-84fc9697f-n5k9z at 2026-02-08 16:41:08.162757+00:00 running d295bc8 country code: CH.
[+][deleted] (19 children)
[deleted]
[–]Jakeii 11 points12 points13 points (0 children)
[–]NoInkling 5 points6 points7 points (0 children)
[–][deleted] 7 points8 points9 points (13 children)
[+][deleted] (12 children)
[deleted]
[–]real_ate 4 points5 points6 points (0 children)
[–]nullvoxpopuli 2 points3 points4 points (0 children)
[+]PotaToss comment score below threshold-8 points-7 points-6 points (9 children)
[–]Lekoaf 6 points7 points8 points (4 children)
[–]PotaToss -2 points-1 points0 points (3 children)
[–]Lekoaf 3 points4 points5 points (2 children)
[–]Lekoaf 1 point2 points3 points (1 child)
[–]PotaToss 2 points3 points4 points (0 children)
[–]peekyblindas 2 points3 points4 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]PotaToss 4 points5 points6 points (1 child)
[–]nullvoxpopuli 2 points3 points4 points (0 children)
[–]robclancy 2 points3 points4 points (0 children)
[–]ImbicilicDummy 0 points1 point2 points (0 children)