feat: init rsc support for translation (#30596)

This commit is contained in:
Stephen Zhou
2026-01-06 13:23:03 +08:00
committed by GitHub
parent 89463cc11d
commit b2124a7358
10 changed files with 202 additions and 214 deletions

View File

@@ -2,7 +2,7 @@
import { cache } from 'react'
export default <T>(defaultValue: T): [() => T, (v: T) => void] => {
export function serverOnlyContext<T>(defaultValue: T): [() => T, (v: T) => void] {
const getRef = cache(() => ({ current: defaultValue }))
const getValue = (): T => getRef().current