Skip to main content

One post tagged with "React"

View All Tags

Core and React in v10

· 13 min read
Maciej Pyrc
Creator of Hyper Fetch | @BetterTyped
Feature

Core and React in v10

Optimistic helpers, infinite lists, SSR hydration and a hardened core.

todos.ts×
const toggleTodo = updateTodo.setOptimistic(({ params, payload }) => [
// Applied before the request is sent, refetched once it settles
optimistic(getTodos).patch(params.todoId, payload),
]);

Optimistic updates, infinite lists and server rendering are the parts of a data layer that every app rebuilds by hand. HyperFetch 10 ships them in @hyper-fetch/core and @hyper-fetch/react: helpers that describe an optimistic change while core handles the rollback, a useInfiniteFetch hook, a Hydrate component, retry backoff and offline queues that survive a reload. Under that sits two weeks of hardening of the cache, the dispatcher and every hook.