Skip to content
Source
Sign inSign up
TanStack/router

chore: update migration docs for next/image #5326

MergedAlemTuzlakmerged 1 commit intomain fromrefs/pull/5326/headmerged by schiller-manuel(GitHub profile, opens in a new tab)

Showing 1 changed file with 23 additions and 0 deletions.

x
0 of 1 viewed, 1 left
23 additions and 0 deletionsdocs/start/framework/react/migrate-from-next-js.mdModified
View file
@@ -304,6 +304,29 @@
​
Learn more about the [Links](/router/latest/docs/framework/react/guide/navigation#link-component).
​
+### Images
+​
+Next.js uses the `next/image` component for optimized images. In TanStack Start, you can use the package called [Unpic](https://unpic.pics/) for similar functionality
+and almost a drop-in replacement.
+​
+```tsx
+import Image from "next/image" // [!code --]
+import { Image } from "@unpic/react"; // [!code ++]
+function Component() {
+ return (
+ <Image
+ src="/path/to/image.jpg"
+ alt="Description"
+ width="600" // [!code --]
+ height="400" // [!code --]
+ width={600} // [!code ++]
+ height={400} // [!code ++]
+ />
+ )
+}
Thread on lines 309 to 326

⚠️ Potential issue | 🟠 Major

Add install step for Unpic before showing usage.

The new snippet imports @unpic/react, but we never tell readers to install it. Following the guide as written will crash at build time with “Cannot resolve module '@unpic/react'.” Please insert an install command (e.g. npm install @unpic/react) in this section before the code sample so the migration instructions are complete.

 ### Images

 Next.js uses the `next/image` component for optimized images. In TanStack Start, you can use the package called [Unpic](https://unpic.pics/) for similar functionality
 and almost a drop-in replacement.

+Install the React component:
+
+```sh
+npm install @unpic/react
+```
+
 ```tsx
 import Image from "next/image" // [!code --]
 import { Image } from "@unpic/react"; // [!code ++]
🤖 Prompt for AI Agents
In docs/start/framework/react/migrate-from-next-js.md around lines 309 to 326,
the example imports @unpic/react but never tells readers to install it; add an
install step immediately before the code block (e.g., a short sentence and the
npm install @unpic/react command, with equivalent yarn/pnpm examples if you
prefer) so users can install the package before trying the snippet and avoid the
“Cannot resolve module '@unpic/react'” build error.