Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
davidmccabe
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
by
davidmccabe
3y ago
GraphQL is really intended to model UI concepts rather than directly exposing your database schema. First of all, your GraphQL schema is basically append-only due to older clients that may remain in the wild. So you don't want to expos
2.
▲
New Official Relay Tutorial
(relay.dev)
2 points
by
davidmccabe
4y ago
|
1 comments
3.
▲
by
davidmccabe
4y ago
Hey, this is David from the React team at Meta. I've been working on revamped documentation for Relay, our GraphQL data fetching library. Relay is an incredible technology but has been virtually undocumented up until now. This tutorial
4.
▲
by
davidmccabe
6y ago
We are planning in the next few weeks an overhauled persistence API. Among other things this will add the ability to provide a callback in `initializeState` rather than a value. However, this doesn't help if you need to do async work t
5.
▲
by
davidmccabe
6y ago
React doesn't have to commit to the DOM if there are no changes, but it still has to render each component and compare the output. Even if the component is memoized, it still has to compare the props. This is fast enough most of the ti
6.
▲
by
davidmccabe
6y ago
I could be mistaken but I think that you still have to do a shallow compare on the connected props of every component.
7.
▲
by
davidmccabe
6y ago
Well, I should say "doesn't make it harder". The `RecoilRoot` component accepts a prop called `initializeState` that lets you specify the state of all atoms in the initial render.
8.
▲
by
davidmccabe
6y ago
For a specific set of atoms you could subscribe to them with a component and then use an effect to send the values out. For all atoms you could use useTransactionObservation.
9.
▲
by
davidmccabe
6y ago
It’s actually designed to make server rendering easy. We’ll add a guide about this eventually. Atoms aren't global singletons: their values are scoped to React trees.
10.
▲
by
davidmccabe
6y ago
The term 'atom' is a clojure-ism, that's where both I and reframe get it from.
11.
▲
by
davidmccabe
6y ago
If you update multiple atoms within a React batch, they will be updated at the same time, just as with React local state. You don't need to wrap the changes in anything to have them occur together. In other words, this updates both of
12.
▲
by
davidmccabe
6y ago
The app in question had thousands of connected components, so that was a huge bottleneck for them. For many apps it doesn't matter. The app that Recoil was originally extracted from has an extremely complex set of state and interdepend
13.
▲
by
davidmccabe
6y ago
Well, I know that on one tool we saw a 20x or so speedup compared to using Redux. This is because Redux is O(n) in that it has to ask each connected component whether it needs to re-render, whereas we can be O(1). useReducer is equivalent t