You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/start/framework/react/fetching-external-api.md
+37-33Lines changed: 37 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,12 @@ id: fetching-external-api
3
3
title: Calling an external API using TanStack Start
4
4
---
5
5
6
-
This guide demonstrates how to integrate external API calls into your TanStack Start application using route loaders. We will use TMDB API to fetch popular movies using TanStack Start and understand how to fetch data in a TanStack Start app.
7
-
6
+
This guide demonstrates how to integrate external API calls into your TanStack Start application using route loaders. We will use TMDB API to fetch popular movies using TanStack Start and understand how to fetch data in a TanStack Start app.
8
7
9
8
The complete code for this tutorial is available on [GitHub](https://github.com/shrutikapoor08/tanstack-start-movies).
10
9
11
-
12
10
## What You'll Learn
11
+
13
12
1. Setting up external API integration with TanStack Start
14
13
1. Implementing route loaders for server-side data fetching
15
14
1. Building responsive UI components with fetched data
@@ -21,8 +20,8 @@ The complete code for this tutorial is available on [GitHub](https://github.com/
Let's break down how the different parts of our application work together:
264
269
265
270
1. Route Loader: When a user visits `/fetch-movies`, the loader function runs on the server
@@ -268,15 +273,14 @@ Let's break down how the different parts of our application work together:
268
273
4. Component Rendering: The `MoviesPage` component receives the data via `Route.useLoaderData()`
269
274
5. UI Loads: The movie cards are rendered with the fetched data
270
275
271
-
272
276
## Step 6: Testing Your Application
273
-
Now you can test your application by visiting http://localhost:3000/fetch-movies. If everything is set up correctly, you should see a beautiful grid of popular movies with their posters, titles, and ratings. Your app should look like this:
274
277
278
+
Now you can test your application by visiting http://localhost:3000/fetch-movies. If everything is set up correctly, you should see a beautiful grid of popular movies with their posters, titles, and ratings. Your app should look like this:
275
279
276
280

277
281
278
-
279
282
## Conclusion
283
+
280
284
You've successfully built a movie discovery app that integrates with an external API using TanStack Start. This tutorial demonstrated how to use route loaders for server-side data fetching and building UI components with external data.
281
285
282
-
While fetching data at build time in TanStack Start is perfect for static content like blog posts or product pages, it's not ideal for interactive apps. If you need features like real-time updates, caching, or infinite scrolling, you'll want to use TanStack Query on the client side instead. TanStack Query makes it easy to handle dynamic data with built-in caching, background updates, and smooth user interactions. By using TanStack Start for static content and TanStack Query for interactive features, you get fast loading pages plus all the modern functionality users expect.
286
+
While fetching data at build time in TanStack Start is perfect for static content like blog posts or product pages, it's not ideal for interactive apps. If you need features like real-time updates, caching, or infinite scrolling, you'll want to use TanStack Query on the client side instead. TanStack Query makes it easy to handle dynamic data with built-in caching, background updates, and smooth user interactions. By using TanStack Start for static content and TanStack Query for interactive features, you get fast loading pages plus all the modern functionality users expect.
0 commit comments