Open phymo opened 1 month ago
use server
cache
loading ui
& streaming
& suspense
) allow you to progressively render and incrementally stream rendered units of the UI to the client.taintObjectReference
and taintUniqueValue
: // next.config.js
module.exports = {
experimental: {
taint: true,
},
}
// app/utils.ts
import { queryDataFromDB } from './api'
import {
experimental_taintObjectReference,
experimental_taintUniqueValue,
} from 'react'
export async function getUserData() {
const data = await queryDataFromDB()
experimental_taintObjectReference(
'Do not pass the whole user object to the client',
data
)
experimental_taintUniqueValue(
"Do not pass the user's address to the client",
data,
data.address
)
return data
}
fetch data on server
with fetch