Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
acemarke
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
24 ms
·
211.
▲
by
acemarke
4y ago
Glancing at it very quickly via Unpkg, I _think_ you really just need to fix the broken `types` path reference in `package.json`. Right now, your `dist` folder has `dist/index.d.ts` available, but `package.json` points to: "
212.
▲
by
acemarke
4y ago
This particular use case is trying to strongly type the "Flux Standard Action" object shape. An object _may_ have a `payload` field for its data, _may_ have an `error` field that indicates this action represents an error, and _ma
213.
▲
by
acemarke
4y ago
Note that our official Redux Toolkit package, linked in the article, has complex TS types specifically _because_ we work to simplify the TS usage experience for our users. Here's all you need to do as a typical Redux app developer to g
214.
▲
by
acemarke
4y ago
I'll agree, and disagree. I made a similar comment in 2019 about "TS pushes you towards simpler APIs" [0], so I agree that it's both a good thing in principle, and something TS usage leans towards in practice. At the sam
215.
▲
by
acemarke
4y ago
Heh, it's amusing to see Redux Toolkit referenced here. I'm one of the two main RTK maintainers. My co-maintainer Lenz Weber is responsible for most of our TS type wizardry. Agreed that writing TS types for libs can be a pain. I
216.
▲
by
acemarke
4y ago
Yep, this is why we're building a time-travel debugger for JS at https://replay.io . The basic idea of Replay: Use our special browser or Node forks to make a recording of your app, load the recording in our debugger, and y
217.
▲
by
acemarke
4y ago
Thanks, glad to hear that info's been helpful! :)
218.
▲
by
acemarke
4y ago
No. React-Redux only uses Context to pass down _the Redux store instance_, not _the current state value_. The store instance doesn't change, so that use of context will never cause later re-renders. Instead, components directly call `
219.
▲
by
acemarke
4y ago
I'm not sure, tbh. I agree that having the ability to construct objects/arrays that are compared by nested values, rather than references, will be useful. But, given that Immer already exists, and only meaningfully requires ES6 Pr
220.
▲
by
acemarke
4y ago
Yeah, we specifically built Redux Toolkit around Immer from the very first prototype that I wrote. I had catalogued _dozens_ of immutable update libs between 2015-2018, and Immer is simply superior to all of them. Which is why Immer is a no
221.
▲
by
acemarke
4y ago
Yep! Also see Shawn Swyx Wang's talk "Getting Closure on React Hooks", where he goes through an equivalent example in more detail: https://www.swyx.io/hooks/
222.
▲
by
acemarke
4y ago
Heh, unfortunately "update my rendering post to cover React 18" has been on my todo list for _months_ now :) As in, I literally have a todo list entry that I keep bumping back until "Next Sunday", because other stuff is
223.
▲
by
acemarke
4y ago
FWIW, React has always been designed around some Functional Programming type principles, such as immutable updates. Immutable updates do in fact require that if you want to update `state.some.nested.field`, you have to make copies of _all_
224.
▲
by
acemarke
4y ago
Josh's post is excellent! Related, a couple years back I wrote a post on the same topic: "A (Mostly) Complete Guide to React Rendering Behavior" [0]. It's longer and has more details, but fewer diagrams :) (Josh's
225.
▲
by
acemarke
4y ago
Hi, I'm the primary maintainer for Redux, and I've spent much of the last several years helping answer questions about React and Redux. We've got a curated list of learning resources for JS, React, Redux, and TS over on the R
226.
▲
by
acemarke
4y ago
Nice, yeah, I can see the focus on "what actions" being useful. I'm an engineer, not GTM, so I'm not sure how the test runs feature plays into the listed "X recordings per month" at https://www.repla
227.
▲
by
acemarke
4y ago
Obligatory alternative tool plug / comparison: I work for https://replay.io , which is a true time-traveling debugger for JS. We have forks of Firefox, Chrome, and Node, instrumented to capture syscalls at the OS level. T
228.
▲
by
acemarke
4y ago
> Every new change you want to make to the store, you have to make about five changes across five different files This has never actually been a requirement to use Redux. Admittedly, having separate folders and files by type _was_ a patt
229.
▲
by
acemarke
4y ago
No, RTK is a wrapper around just Redux patterns, not React. - store setup: `configureStore` creates a store with a good default config in one function call - Reducers: `createSlice` lets you define case reducers as functions in an object, w
230.
▲
by
acemarke
4y ago
Generally: - Use the React DevTools Profiler to identify components that are rendering more than expected, or taking too long to render - Wrap key components in `React.memo()` to have React avoid recursing through those subtrees unless the
231.
▲
by
acemarke
4y ago
Eh, there was entirely valid reasons for the backlash :) Redux _was_ overused in the first couple years. The original patterns _were_ very boilerplate-y. There _are_ a lot of other good tools for varying use cases that overlap with things t
232.
▲
by
acemarke
4y ago
Just to check, have you had a chance to try out Redux Toolkit? We specifically designed it to eliminate the previous "boilerplate" concerns with legacy Redux patterns: - https://redux.js.org/introduction/why-r
233.
▲
by
acemarke
4y ago
Assuming you meant Redux Toolkit (RTK) Query there. FWIW, the stance of both the Redux maintainers (myself and Lenz) and the React/TanStack Query maintainers (Tanner and Dominik) is: - If you're using Redux at all, prefer using RT
234.
▲
by
acemarke
4y ago
Absolutely, yes. My blog ( https://blog.isquaredsoftware.com ) is primarily a way for me to share teaching material around React, Redux, JS, and TS. Most of my blog posts have been written in response to questions other folks h
235.
▲
by
acemarke
4y ago
I wrote a post on useful Git techniques and practices that may be helpful: https://blog.isquaredsoftware.com/2021/01/coding-career-git-...
236.
▲
by
acemarke
4y ago
Hiya. As mentioned in my other comment, I decided to write up a blog post about all the different potential metrics you can use to estimate package market share, flaws with those metrics, and how I use them to guesstimate React state manage
237.
▲
by
acemarke
4y ago
I've debated throwing together a docs page with a bunch of quotes and links to people saying how much they enjoy using RTK, but I've got enough other stuff on my plate that it hasn't been a priority.
238.
▲
by
acemarke
4y ago
I would strongly suggest reading through my extensive post "A (Mostly) Complete Guide to React Rendering Behavior" [0], which walks through what "rendering" actually is, what triggers it, React's default behavior, a
239.
▲
by
acemarke
4y ago
I actually wrote a whole blog post on this a couple years ago! I threw out a list of 30-ish criteria off the top of my head, and linked to a few other posts with some additional lists of criteria: https://blog.isquaredsoftware.co
240.
▲
by
acemarke
4y ago
> React is a child of the Flux architecture philosophy FWIW, this isn't actually the case. React was first announced in 2013: - https://en.wikipedia.org/wiki/React_(JavaScript_library) The "Flux Architectu
More ›