Skip to content
Source
Sign inSign up
TanStack/virtual

docs(examples): rebuild the React chat example as a ChatGPT-style app #1331

Mergedpiecykmerged 9 commits intomain fromrefs/pull/1331/headmerged by piecyk

Showing 7 changed files with 230 additions and 0 deletions (loading 3).

x
0 of 7 viewed, 7 left
5 additions and 0 deletionsexamples/react/chat/README.mdModified
View file
@@ -7,6 +7,11 @@
- follows appended output only when the viewport is already at the latest message
- keeps streaming bottom output pinned as the last row grows
​
+The UI is a simple ChatGPT-style layout: a sidebar with chat history and a
+message pane with a composer. Data comes from an in-memory mock API
+(`src/api.ts`) through TanStack Query, and assistant replies are generated and
+streamed word by word, so the example needs no server or API key.
+​
```bash
npm install
npm run dev
1 addition and 0 deletionsexamples/react/chat/package.jsonModified
View file
@@ -8,6 +8,7 @@
"serve": "vite preview"
},
"dependencies": {
+ "@tanstack/react-query": "^5.80.7",
"@tanstack/react-virtual": "^3.14.19",
"react": "^19.2.7",
"react-dom": "^19.2.7"