원본에서 계산하는 상태
Derived State From Authoritative Inputs
Prevent totals, filtered lists, and dirty flags from drifting away from their inputs.
이 자료로 구현하기
원문 주소와 버전이 포함된 요청문입니다. 복사한 뒤 만들 화면과 요구사항을 채워 에이전트에게 전달하세요.
FROM PRINCIPLE TO PRACTICE
이 원리로 만든 예제 20
예제를 열어 직접 조작하고, 관찰한 동작을 이 문서의 원리와 비교해 보세요.
The weight of a moment.
- 02 / Keyframes & independent tracks · evaluateBounce
A deterministic bounce evaluator maps the playhead to separate height, squash and color tracks. The impact keyframe is editable; the graph and sphere use the same evaluated values. This binding describes the authored study and does not verify the original project.
- 02 / Keyframes & independent tracks · evaluateBounce
One object. Two truths.
- 03 / Material passes & compositing · projectKnot
An independently generated torus knot is projected once into two offscreen 2D render targets. Solid and wire passes share geometry and camera; a directional alpha mask composites their outputs. This browser-canvas study isolates the article’s render-target principle without claiming its Three.js shader implementation. This binding describes the authored study and does not verify the original project.
- 03 / Material passes & compositing · projectKnot
Depth without drift.
- 20 / Generated coordinates & camera projection · mapGeneratedVertex
An original indexed patch reuses a persistent position buffer. Normalized generated coordinates map through cover sizing and optional camera-ray compensation into a Three.js perspective camera. Actual updated vertex positions are projected with that camera and compared in CSS pixels with an independently calculated 2D cover reference. No camera or face inference is used. This binding describes the authored study and does not verify the original project.
- 20 / Generated coordinates & camera projection · mapGeneratedVertex
연결된 예제 17개 더 보기
People make the pattern.
- 07 / Rolling digits & member collage · renderMembers
Measured digit strips settle with digit-specific revolutions and durations. Twelve original geometric portrait cards use stable local IDs and container-relative collage positions, then orbit only after the count completes. This binding describes the authored study and does not verify the original project.
- 07 / Rolling digits & member collage · renderMembers
One state. Two surfaces.
- 22 / Semantic content & pixel treatment · renderSharedCover
One application state owns caption, accent and effect. Both a semantic HTML card and an independently drawn Canvas2D cover consume the same snapshot. Pixelated mode paints that cover into a smaller detached canvas, then enlarges it with image smoothing disabled. Inputs and resize events redraw the current state without replacing native controls. This is manual drawing of known content, not automatic HTML rasterization. This binding describes the authored study and does not verify the original project.
- 22 / Semantic content & pixel treatment · renderSharedCover
A frame becomes a page.
- 08 / Design tree & responsive constraints · renderDesignTree
A local design-tree fixture is rendered into a section, header, article and native action. Prepared and fixed-frame modes expose the effects of logical sizing, min/max bounds and shared spacing variables without connecting to Figma or WordPress. This binding describes the authored study and does not verify the original project.
- 08 / Design tree & responsive constraints · renderDesignTree
Twelve views, one orbit.
- 11 / Perspective ring composition · renderOrbit
Twelve CSS 3D card transforms share one orbit parent. Each card uses a fixed index-derived 30-degree angle plus a depth translation; radius, tilt, parent rotation and scene scale remain separately editable. Keyboard-operable card selection and angle controls replace any need for a custom cursor. This binding describes the authored study and does not verify the original project.
- 11 / Perspective ring composition · renderOrbit
Scroll is the director.
- 12 / Cylindrical camera sequence · spinImpulse
A software-projected cylinder samples an original procedural panel atlas. Document progress sets the camera path, base rotation and chapter selection. A closed-form exponentially decaying spin impulse derives rotation and particle energy from the same scrubbed time. This is a deterministic study of inertia, not a claim that live wheel velocity was measured. This binding describes the authored study and does not verify the original project.
- 12 / Cylindrical camera sequence · spinImpulse
A window with depth.
- 15 / Pointer input & bound layers · renderBoundParallax
One normalized pointer model drives bounded transforms for three independently illustrated DOM/SVG layers. Direct input and bound-model modes share the same render function, with reset and native coordinate controls. The setting is a botanical display, without game, staking, transaction or provider-runtime behavior. This binding describes the authored study and does not verify the original project.
- 15 / Pointer input & bound layers · renderBoundParallax
One model. Every measure.
- 17 / Data-bound quantity calculator · projectBarModel
A local data model owns grams per bar, quantity and demonstration units per gram. Total mass and total price are derived by multiplication; original SVG bar dimensions, count and labels update together. No market-data, financial-quote or provider API is involved. This binding describes the authored study and does not verify the original project.
- 17 / Data-bound quantity calculator · projectBarModel
Fit the frame. Keep the shape.
- 18 / Texture fitting & crop anchors · fitTexture
The CPU calculates image and plane aspect-ratio fitting only when its dimension inputs change. A simple texture sampler consumes the derived UV scale and anchor offset. Cover and contain share one fit calculation with zero-size guards; a collapse animation updates only the changing plane dimension. This binding describes the authored study and does not verify the original project.
- 18 / Texture fitting & crop anchors · fitTexture
Meet Pip. Find the beat.
- 19 / SVG pose & frame timing · pickHeldFrame
An original seed character uses grouped SVG pivots, a clipped ground plane, a continuous pose evaluator and a discrete variable-hold frame selector. The flag inherits the hand transform. This binding describes the authored study and does not verify the original project.
- 19 / SVG pose & frame timing · pickHeldFrame
Activity Dropdown · Gamma UI
- 활동 수와 상대 시간은 고정 예제 데이터
activities는 다섯 개의 고정 객체이고 헤더의 5 New Activities도 별도 문자열입니다. Just Now 같은 time 값은 시계에서 계산되지 않으며 읽음 상태나 데이터 수신 코드가 없습니다. 목록에 항목을 추가해도 헤더 숫자를 자동으로 계산하는 구조는 아닙니다.
- 활동 수와 상대 시간은 고정 예제 데이터
Separate Pagination · Myna UI
- 고정 요약과 고정 페이지의 관계
Showing 2 of 25는 직접 적은 p이고 isActive는 2에 고정됩니다. 목록은 1·2·3·8·9와 Next만 제공하며 전체 25와 표시 범위를 계산하는 코드가 없습니다. 요약은 조회된 결과 수의 증거가 아닙니다.
- 고정 요약과 고정 페이지의 관계
Tag Table With Sort Menu · 21st/shadcn
- 검색 후 정렬한 여섯 태그
WithSort는 search와 {key, order}를 저장하고 태그 6개를 이름·설명·relatedTags의 소문자 포함 검색으로 걸러 정렬합니다. 숫자 bookmarks는 검색하지 않고 입력 공백을 trim하지 않습니다. filter 결과를 정렬하므로 원래 tags 배열 순서는 직접 바꾸지 않습니다.
- 검색 후 정렬한 여섯 태그
Bookmark Table With Search · 21st/shadcn
- 제목만 검색하는 북마크 목록
원본 북마크 5개는 useState에 넣지만 setter를 사용하지 않습니다. searchTerm은 title.toLowerCase().includes에만 적용하므로 URL·태그·설명은 검색 대상이 아닙니다. 검색 결과가 없을 때 별도 안내 행도 없습니다.
- 같은 열은 방향 전환, 다른 열은 오름차순
초기 정렬은 title 오름차순입니다. handleSort는 같은 열을 누르면 방향을 바꾸고 다른 열이면 오름차순부터 시작합니다. sortedBookmarks는 filter가 만든 배열을 제자리 정렬하며 tags 배열 비교는 별도 도메인 비교 함수 없이 <·>에 맡깁니다.
- 제목만 검색하는 북마크 목록
Table Column Visibility · 21st/shadcn
- 다시 켠 열은 마지막에 붙는다
열을 다시 선택할 때 [...prevColumns, column]으로 끝에 붙입니다. 따라서 Username을 끈 뒤 켜면 첫 열로 돌아오지 않습니다. 메뉴는 고정 columns 순서를 쓰고 표는 선택 배열 순서를 쓰므로 둘의 순서가 달라질 수 있습니다.
- 다시 켠 열은 마지막에 붙는다
Card stack겹친 이야기
- 현재 카드에서 함께 계산하는 표시
세 카드의 현재 인덱스로 겹침 순서와 보조 기술에 노출할 카드를 함께 계산합니다. DOM을 재정렬하지 않고, 버튼을 누른 순간 선택을 바꾸어 전환 완료를 기다리지 않습니다.
- 현재 카드에서 함께 계산하는 표시
Scroll progress읽는 만큼 차오르는 선
- 읽기 영역의 현재 기하에서 계산하는 비율
진행률은 예제 내부의 스크롤 위치를 가능한 이동 거리로 나눈 값입니다. 같은 비율로 숫자와 막대를 갱신하며 읽기 완료나 이해도를 뜻하지 않습니다. 현재 갱신은 초기화와 스크롤 이벤트에만 연결되어 크기 변경 전용 재계산은 없습니다.
- 읽기 영역의 현재 기하에서 계산하는 비율
Story carousel넘겨 읽는 목소리
- 한 인덱스가 고르는 문장과 작성자
이전·다음 버튼이 세 항목의 인덱스를 순환하고 후기 문장·기호·이름·번호를 즉시 바꿉니다. 자동 재생이나 카드 이동 전환은 없으며 문장과 인물은 이 로컬 스터디의 예시 데이터입니다.
- 한 인덱스가 고르는 문장과 작성자
Repository Boundary
Prevent totals, filtered lists, and dirty flags from drifting away from their inputs. This pattern belongs to Design Engineering and adds no Layout CSS or shared store implementation.
Reusable Method
Use when a value is a deterministic projection of current inputs. Store historical snapshots when the task explicitly needs what was true at a previous event; those are not redundant current projections.
State Model And Ownership
Only source items and filter are writable. Visible items and total are computed. Memoization is optional and must include every dependency; its lifetime cannot change meaning.
Transitions
| Event and precondition | Next state | Effect or invariant |
|---|---|---|
| Items change | New items | Recompute projection from current inputs |
| Filter changes | New filter | Project without mutating items |
| No matching items | Empty projection | Total is zero, not a separate empty flag |
Minimal Executable Example
Run this standalone JavaScript block with Node.js 22 or newer, or run all pattern examples from a repository checkout with bun run test:state-management. The assertions exercise the local model, not a browser or backend.
import assert from "node:assert/strict";
let items = [{ id: "a", price: 5 }, { id: "b", price: 12 }];
let minimum = 10;
const visible = () => items.filter(item => item.price >= minimum);
const total = () => visible().reduce((sum, item) => sum + item.price, 0);
assert.equal(total(), 12);
items = items.map(item => item.id === "b" ? { ...item, price: 7 } : item);
assert.deepEqual(visible(), []);
assert.equal(total(), 0);
minimum = 0;
assert.equal(total(), 12);What Breaks If Removed
An independently updated total can miss a deletion, filter change, or remote refresh. A memo keyed only by items stays stale after changing the filter.
Composition And Substitution
Combine with ID selection; derive the selected object from the current collection. Keep submitted snapshots because they represent a past event.
Opinionated Guidance
Write down the projection before introducing another writable field. Define domain equality explicitly for dirty checks involving normalized dates, numbers, or nested data.
Platform-Specific Guidance
Framework memo and selector APIs have different invalidation rules. Verify dependency coverage and immutable update assumptions in the chosen adapter.
Unsupported Absolutes
Recomputing every projection is not always cheap; storing a cache can be valid if its invalidation contract is explicit.
Verification Contract
- Change each dependency independently and inspect the projection.
- Delete the final matching item and verify the empty result and zero total.
- If memoized, repeat with unchanged references and changed filter inputs.
Record actual outcomes separately using the verification matrix.
Source, License, And Attribution
Locally authored synthesis and examples. No upstream implementation is copied. These experimental contracts describe consumer-owned behavior; review when a failure, ownership change, or platform change invalidates an assumption.
IA Navigation
Parent: State Management. Next: Continue the state management route.


