Based on the example source code from Inertiajs (https://inertiajs.com/shared-data#accessing-shared-data), we can use usePage()
hook to get the props that passing from server-side
import { usePage } from '@inertiajs/react'
export default function Layout({ children }) {
const { auth } = usePage().props
return (
<main>
<header>
You are logged in as: {auth.user.name}
</header>
<content>
{children}
</content>
</main>
)
}
My question is how can we get the data (come from the server-side) inside the Class Component? Or what is the replacement for the usePage() hook in the Class Component?