ad556aee1b
For the server compilation, we currently transpile the dynamic import expression to `null` if `ssr` is disabled. However to make the Server Actions layer work (as it can be created again from a Client Component), we can't do that optimization. This PR changes it to always keep that import expression when `react_server_components` (App Router) is enabled, no matter which layer it's on. Closes #52672.
11 lines
247 B
JavaScript
11 lines
247 B
JavaScript
'use client'
|
|
|
|
import { inc } from '../client/actions'
|
|
import { useState } from 'react'
|
|
|
|
export function CSR() {
|
|
const [count, setCount] = useState(0)
|
|
return (
|
|
<button onClick={async () => setCount(await inc(count))}>{count}</button>
|
|
)
|
|
}
|