Sa’nin live preview veya developer tools özelliklerini kullanırken, fetch edilen içeriğe gizli izleme verileri (stega data) eklenebilir. Bu veriler şunları içerebilir:
Sanity’nin live preview veya developer tools özelliklerini kullanırken, fetch edilen içeriğe gizli izleme verileri (stega data) eklenebilir. Bu veriler şunları içerebilir:
How to use React 19 Hook
Bonus: React’s new use() hook
This one is not really a rendering strategy, but it can be very helpful when combined with things like SSR and CSR or PPR.
With React 19 and Next.js 15, you can start fetching data on the server but you don't have to wait for it right away. Then, inside a Client Component, you can use the new use() hook to read that data once it's ready.
This is useful in a few common cases:
You are fetching data that includes secrets or tokens, which should never be exposed to the browser
You are using server-only tools like Prisma
You want to avoid making the same fetch twice, once on the server and once on the client
When someone visits the page, the server starts fetching the data immediately. While the data is still loading, the server sends the initial HTML to the browser to keep things fast. Once the data is ready, the server includes it in the response and React continues rendering the Client Component that uses the use() hook to read that data.
Using use() inside a Client Component automatically triggers React Suspense. This means you can wrap that component in a <Suspense> boundary and show a loading spinner or some fallback UI while the data is still loading.
This gives you a nice user experience. Your page shell appears right away, and the dynamic parts pop in smoothly when the data is ready.
1"use client";2import{Post}from"@/lib/types";3import{ use }from"react";45exportfunctionPostTitle({ postPromise }:{ postPromise:Promise<Post>}){6const post =use(postPromise);7return<p>Post Title: {post.title}</p>;8}
You can use this approach for getting data from database directly. Because you can't run prisma functions in client side. But you can start the request in server side and don't wait for data, the data will come later.