这里我们有
root
组件,比方说 app.tsx
,它调用 CSR
组件并作为子 SSR
组件传递
const App = () => {
return (
<CSRComp >
<SSRComp />
</CSRComp>
);
};
export default App;
"use client"
import {useState} from "react";
const CSRComp = ({children}) => {
const [count, setCount] = useState(0);
return (
<p>Client side component</p>
<p>{count}</p>
<button onClick(() => {setCount(count + 1)}) />
{children}
);
};
export default CSRComp;
const SSRComp= () => {
return (
<p>Server side component</p>
);
};
export default SSRComp;
是
CSRComp
使得 SSRComp
CSR
因为它本身就是 CSR
?
SSRComp
应该还是留下SSR
吧?