Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ng12
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
43 ms
·
451.
▲
by
ng12
6y ago
You really don't have to think about it. This all falls into the category of performance hacking. React renders are cheap, DOM renders are expensive. Extraneous React renders are only a potential issue if you're doing something ug
452.
▲
by
ng12
6y ago
And so you introduce a simple build step to improve your development experience.
453.
▲
by
ng12
6y ago
But what good are classes if you're not doing object-oriented programming? React classes are just stateful wrappers around a pure render function. It's not idiomatic and frankly dangerous to do anything you would with a regular ES
454.
▲
by
ng12
6y ago
> And anyone who has used classes in Java or other languages would feel at home. Not really because there's nothing object oriented about React.Component. It's just a wrapper for a function implemented as a class.
455.
▲
by
ng12
6y ago
The callback is always defined it's just not always invoked. Otherwise it's a regular lexical closure like any callback in JavaScript. Maybe I'm not understanding what you mean by dynamic scope.
456.
▲
by
ng12
6y ago
> Personally, I strongly prefer hooks to HOCs. To me this is the most visible win. useSelector for Redux, useIntl for react-intl, useHistory for react-router, useStyles for material-ui, etc. Almost every library I use radically simplifie
457.
▲
by
ng12
6y ago
But everything in that dependency array is from lexical scope, correct? Your hooks execute in the scope of that call to MyComponent().
458.
▲
by
ng12
6y ago
I don't really understand this. Can you explain how hooks relate to dynamic scoping?
459.
▲
by
ng12
6y ago
> Things like updating reducer state by using a spread object, which creates a new object which can then send a system haywire This is what you should be doing and not doing this seems more likely to cause problems. Do you have an exampl
460.
▲
by
ng12
6y ago
Angular does not have a solution for this as far as I know. It's not about re-using logic. It's about re-using reactive logic that ties in to your component's lifecycle.
461.
▲
by
ng12
6y ago
Well #2 isn't really a pitfall, for starters. I have a new feature that solved a problem I had but I can't use it in the code I wrote before I had it without refactoring? I don't think that critique really has anything to do
462.
▲
by
ng12
6y ago
> But it should suffice to say, FUNCTIONS DO NOT HAVE STATE It's funny you say that: useState is the same model functional languages use to handle mutability. https://docs.racket-lang.org/reference/boxes.html
463.
▲
by
ng12
6y ago
Exactly this. Class components let you cheat and easily write components that were broken if a prop was unexpectedly updated. Hooks will surface this immediately.
464.
▲
by
ng12
6y ago
I'm not sure if I buy the interest bit. It's common knowledge that CS is lucrative and lot of students will grind through programs they don't enjoy for the paycheck at the end. My experience was that some people are cut out t
465.
▲
by
ng12
6y ago
Isn't this all stuff that you add after generating the project? For example yarn.lock is created on your first install. Having a pre-generated yarn.lock is a no-go because of the dubious decision to include the full path to the registr
466.
▲
by
ng12
6y ago
It's already been patched with version 2.2.1.
467.
▲
by
ng12
6y ago
Looks like it broke @angular/cli too.
468.
▲
by
ng12
6y ago
Not likely. The only thing that really matters to me is developer ergonomics. I've never seen a project struggle because it couldn't render a table with a 1,000 rows fast enough. I have seen many projects struggle because they hir
469.
▲
by
ng12
6y ago
Agreed. I've had so many problems in the last few months. An incredibly lazy fake that was "Sold by Amazon", a book with water damage in pristine packaging, and food items that had gone stale. I order everything from Walmart
470.
▲
by
ng12
7y ago
I teach a React workshop and have a slide covering this topic (albeit much less eloquently). I find it really helps JSX feel less exotic.
471.
▲
by
ng12
7y ago
Depends on where you live. The state schools in California are part of one big system so it's very easy to transfer from a community college to a UC (e.g. Berkeley) as long as you have the grades/aptitude.
472.
▲
by
ng12
7y ago
> Vue enforces structure and good patterns early on in the development cycle Could you expand on this? They're both tools for building components, how does Vue enforce more structure? FWIW I usually expect the same high-level struct
473.
▲
by
ng12
7y ago
To my understanding the biggest reason GitLab chose Vue was because they were able to easily mix it in with their existing stack. That's part of what I was referring to by "drop-in". You can do the same with React but it'
474.
▲
by
ng12
7y ago
They're pretty similar. I prefer React because the JavaScript-first approach is much better for large applications. It leads to a smaller API while simultaneously giving you more control over how things work. Also Vue has a lot more ma
475.
▲
by
ng12
7y ago
> Needing to wrap a component in the <Tater /> component is painful Completely disagree. The whole point of React is to do things declaratively and you definitely do not want a component that renders via hook.
476.
▲
by
ng12
7y ago
I agree with this sentiment; I try to not test anything that renders. I don't want to test React's correct handling of the DOM and I don't want tests that fail if someone changes a div to a span. The stuff I'm looking to
477.
▲
by
ng12
7y ago
To put it simply to build a modern Java project you need the jdk + bazel + docker + maven + runtime classpath for a sub-set of npm's features (as far as I know you still can't include two versions of the same maven dependency). F
478.
▲
by
ng12
7y ago
In my experience is the people who complain most audibly about npm are the same folks who think nothing of spending a few days debugging classpath issues.
479.
▲
by
ng12
7y ago
Because we can't even agree on whether React or Vue or Angular is best. In fact this is the root of the issue. It's important to realize that `node_modules` for any project in Popular Framework X will be almost identical. Most of
480.
▲
by
ng12
7y ago
Is node's biggest crime is that it's easy to publish packages? Is this an argument for intentionally complicating package systems?
More ›