Skip to content

Commit

Permalink
Reduce amount of 'use client'.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-you committed Jun 8, 2024
1 parent 46db896 commit 78f754d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions next-app-mock/src/ClientSideScrollRestorer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client"

import {Suspense} from "react"
import {ScrollRestorer} from "../../src"

const ClientSideScrollRestorer = () => {
return <ScrollRestorer />
return <Suspense><ScrollRestorer /></Suspense>
}
export default ClientSideScrollRestorer
6 changes: 3 additions & 3 deletions next-app-mock/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ClientSideScrollRestorer from "@/ClientSideScrollRestorer"
import type {Metadata} from 'next'
import {Inter} from 'next/font/google'
import './globals.css'
import {FunctionComponent, ReactNode, Suspense} from "react"
import {FunctionComponent, ReactNode} from "react"

const inter = Inter({subsets: ['latin']})

Expand All @@ -11,12 +11,12 @@ export const metadata: Metadata = {
description: 'Generated by create next app',
}
const RootLayout: FunctionComponent<{
children:ReactNode
children: ReactNode
}> = ({children}) => {
return (
<html lang="en">
<body className={inter.className}>
<Suspense><ClientSideScrollRestorer/></Suspense>
<ClientSideScrollRestorer/>
{children}
</body>
</html>
Expand Down

0 comments on commit 78f754d

Please sign in to comment.