Data Fetching
Patterns for fetching data with the SDK in Next.js.
Updated
On this page
Split Loading Pattern
For product pages, split the data fetch between server and client:
// Server: Fast initial render with core data
const { product } = await dash.products.getCore("blue-dream")
// Client: Load interactive data on mount
const { options } = await dash.products.getOptions("blue-dream")
Parallel Fetching
// Fetch multiple resources in parallel
const [{ products }, { categories }, globalData] = await Promise.all([
dash.products.list({ limit: 12 }),
dash.categories.getTree(),
dash.getGlobalData(),
])
Preloading
// Preload data for likely next navigation
import { preload } from "react"
preload(() => dash.products.get("popular-product"))
Next Steps
- Caching Strategies — Reducing API calls
- Performance — Optimization tips