useRenderedPagefunction
import { useRenderedPage } from '@mortar-kit/core'
function useRenderedPage(): RenderedPageHow the page being rendered is sent: whether it hydrates, and the CSP nonce for its scripts, so the app can put the nonce on its own scripts (analytics, an inline snippet) and leave out what only works with JavaScript. Read it in a component or layout.
On the server it's what createRender decided for the request (outside
createRender: hydrating, with the request's nonce). In the browser it
says the page hydrates, since only hydrating code runs there, with the
nonce the page's scripts carry.
Returns
Example
function Analytics() {
const page = useRenderedPage();
return <script src="https://stats.example.com/script.js" nonce={page.nonce} defer />;
}