Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
acemarke
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
69 ms
·
661.
▲
by
acemarke
6y ago
Why _not_ React?
662.
▲
by
acemarke
7y ago
Instantiating it does nothing useful, though. `React.Component` is basically an empty shell with a marker flag on it so that the React renderer recognizes it, and the `setState` method just delegates to the actual renderer implementation.
663.
▲
by
acemarke
7y ago
Hi, I'm a Redux maintainer. Hooks definitely lead you towards a different approach for writing components with a different set of tradeoffs. I talked about this in my post "Thoughts on React Hooks, Redux, and Separation of Concer
664.
▲
by
acemarke
7y ago
Cancellation is definitely something that is trickier with thunks. We recently added a new `createAsyncThunk` API [0] to our Redux Toolkit package, which has built-in support for signaling some kind of cancellation using an AbortController
665.
▲
by
acemarke
7y ago
What specific concerns did you have with the redux-thunk types?
666.
▲
by
acemarke
7y ago
It's primarily about naming collisions and indirection. I covered some of the tradeoffs in this post and talk: https://blog.isquaredsoftware.com/2019/07/blogged-answers-th... https://blog.isquareds
667.
▲
by
acemarke
7y ago
Not exactly. I'd strongly recommend reading through the React hooks docs, as well as the other hooks resources I have linked here: https://github.com/markerikson/react-redux-links/blob/master...
668.
▲
by
acemarke
7y ago
Uh... there's not a _single_ React "maintainer". There's a React _team_, which currently consists of: - Seb Markbage: general deep thinking and vision, works on Suspense and some of the server rendering - Andrew Clark: i
669.
▲
by
acemarke
7y ago
Hooks solve a couple different problems: - Giving function components the ability to have internal state and trigger side effects, giving them the same capabilities as class components have had - Reusing logic across components I talked abo
670.
▲
by
acemarke
7y ago
The ordering question is literally just about how you call them within a single specific component. That component can then be used as many times as you want, in as many apps as you want. In other words, this is not legal: const [sta
671.
▲
by
acemarke
7y ago
I'm a Redux maintainer, and yes, I keep trying to tell people that 95% of Redux apps don't need sagas. They're a great power tool for those cases when you have truly complex async workflows, but they're complete overkil
672.
▲
by
acemarke
7y ago
The React team is working on rewriting the docs to focus on function components and hooks first, as of this quarter: https://www.reddit.com/r/reactjs/comments/g2pda4/functional_...
673.
▲
by
acemarke
7y ago
Per other comments in the thread, this is the primary use case for Yarn's "resolutions" feature: https://classic.yarnpkg.com/en/docs/selective-version-resolu...
674.
▲
by
acemarke
7y ago
Unfortunately, that's not redundant, because `typeof null` returns "object": https://2ality.com/2013/10/typeof-null.html
675.
▲
by
acemarke
7y ago
Very unlikely. Web components and React are trying to solve different problems, and the React team has repeatedly said this isn't going to happen.
676.
▲
by
acemarke
7y ago
That might be referring to Yarn's "offline mirror" feature. When enabled, Yarn will cache package tarballs in the designated folder so that you can commit them to the repo. When someone else clones the repo and runs `yarn`,
677.
▲
by
acemarke
7y ago
Hi, I'm a Redux maintainer. I can confirm that Redux will be around for a very long time, and it's easier to use it now than ever before. Please see my post "Redux - Not Dead Yet!" [0] for information on how Redux compa
678.
▲
by
acemarke
7y ago
The React team has been pretty clear that Concurrent Mode needs rendering to be pure, as render methods may get called multiple times but have the results thrown away if the render pass isn't completed and committed to the DOM. The cas
679.
▲
by
acemarke
7y ago
Yeah, I only briefly dabbled with Flow myself a few years back. By the time I got around to looking at TS and Flow again, it was clear TS had won. Someone asked me the other day why TS had gotten more popular than Flow, and this was the su
680.
▲
by
acemarke
7y ago
React itself is written in Flow, but the React team doesn't make any official recommendations as for language or static type syntax to use. That said, a recent survey of /r/reactjs readers [0] showed 50% using plain JS, 48% T
681.
▲
by
acemarke
7y ago
I'll point out that the Redux team (first Dan Abramov and Andrew Clark, now myself and Tim Dorr) never tried to market Redux as something you _must_ use, and in fact have had to actively spend lots of time telling people to _not_ use i
682.
▲
by
acemarke
7y ago
tbh that doesn't sound like a Redux-specific problem. That sounds like a general async / stale-references problem. If you've captured a value and try to use it later, then yeah, you're probably going not going to be us
683.
▲
by
acemarke
7y ago
That sounds very surprising. Yes, React-Redux does batching and cascades updates through the UI layer, but that process should happen extremely quickly (far faster than the amount of time needed for someone to click on another button). I&#
684.
▲
by
acemarke
7y ago
It's important to distinguish between React "rendering" (asking components what they want the UI to look like), and actually applying updates to the DOM. React's default behavior is that when a component renders, React w
685.
▲
by
acemarke
7y ago
Right, and I'm saying that both `mapState` and `useSelector` perform the same behavior: allowing your component to subscribe to portions of the Redux store state, extract that, and update the component when that data changes. So, I don
686.
▲
by
acemarke
7y ago
What do you mean by "can't access Redux state directly" and "copy Redux state"? Neither of those sounds correct. Components have always been able to extract whatever data they want from the store using the `connect
687.
▲
by
acemarke
7y ago
I updated the post yesterday with new links and information, and tweeted a mention of having done that. Apparently someone thought it was worth submitting. (tbh I'd forgotten it actually hit the front of HN when I wrote it the first t
688.
▲
by
acemarke
7y ago
We've recommended normalizing data as a pattern for years [0], but never had any official tooling to support that use case. Redux Toolkit 1.3 now has a new `createEntityAdapter` API that can help with the process of inserting and upda
689.
▲
by
acemarke
7y ago
Trying to clarify FUD on the internet is certainly a fool's errand, but at least I've got a writeup to link to when I see people ask these questions.
690.
▲
by
acemarke
7y ago
Right, and `configureStore` automatically adds the thunk middleware by default [0], as well as the Redux DevTools extension. You'd still have to pass in options for whatever persistence addon you want to use, but that would be somethin
More ›