Using @defer under an array field will return multiple patches. Patches are unique combinations of label
and path
{
items {
id
...frag @defer(label: "my-label")
}
}
git archive --format=zip HEAD `git diff HEAD~1..HEAD --name-only --diff-filter=d | grep -E 'config/locales/.+\.yml|frontend/translations/.+\.js'` > files-changed-to-translate.zip | |
// change 1 to number of commits in pr |
class Spiderman { | |
lookOut() { | |
alert('My Spider-Sense is tingling.'); | |
} | |
} | |
let miles = new Spiderman(); | |
miles.lookOut(); |
Using @defer under an array field will return multiple patches. Patches are unique combinations of label
and path
{
items {
id
...frag @defer(label: "my-label")
}
}
/* | |
A collection of tests where Flow and TypeScript might have different behavior | |
Some tests are borrowed from https://github.com/vkurchatkin/typescript-vs-flow | |
Some tests now have the same behavior as the new versions of Flow/TS have fixed the bugs and improved type safety | |
*/ | |
/* 1. Accessing unknown properties on objects */ |
If you use server rendering, keep in mind that neither useLayoutEffect
nor useEffect
can run until the JavaScript is downloaded.
You might see a warning if you try to useLayoutEffect
on the server. Here's two common ways to fix it.
If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect
instead.
function MyComponent() {
React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.
Table of Contents
React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.
All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.
A number of methods in React are assumed to be "pure".
On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.
// Licensed under CC BY 4.0. | |
type $If<X: boolean, Then, Else = empty> = $Call< | |
& ((true, Then, Else) => Then) | |
& ((false, Then, Else) => Else), | |
X, | |
Then, | |
Else, | |
>; |
// @flow | |
import { ConnectionHandler } from 'relay-runtime'; | |
import { isObject, isArray } from 'lodash/fp'; | |
export function listRecordRemoveUpdater({ parentId, itemId, parentFieldName, store }) { | |
const parentProxy = store.get(parentId); | |
const items = parentProxy.getLinkedRecords(parentFieldName); | |
parentProxy.setLinkedRecords(items.filter(record => record._dataID !== itemId), parentFieldName); | |
} |