fate

A modern data client for React.

Search Login
Thinking...

ViewRefs as the boundary between components

Core Concepts
#views
#normalized-cache
👍106 likes

ViewRefs are intentionally small: a typename, an id, and enough metadata for fate to resolve masked data against a view. Passing refs through the tree keeps component props light and lets each component declare the fields it reads. This post walks through how a PostCard can select title and author while a detail route adds comments, tags, and counts without creating another hand-written data shape.

- Ari

3 Comments

Sora

Passing ViewRefs through components made the example easier to read than a stack of custom DTO types.

Christoph

Optimistic likes are simple, but they make the rollback behavior easy to test in front of someone.

Hana

The Void example deserves a walkthrough because it proves the framework integration boundary is small.

Add a comment