Cannot read properties of undefined (reading ‘isOnlyAdmin’)

  Kiến thức lập trình

Hi all! I’m developing an application on NextJS 14 and I need to include Component={Component} in the main file layout.tsx of the component, and for this I need to specify the TypeAppProps type in the variables of the parent function. Please tell me how to do this
On NextJs 12 the write for how

type here

This is NextJS 12

import MainProvider from '../app/providers/MainProvider'
import type { AppProps } from 'next/app'

import { TypeComponentAuthFields } from '@/shared/types/auth.types'

import '../app/assets/styles/globals.scss'

type TypeAppProps = AppProps & TypeComponentAuthFields

const MyApp = ({ Component, pageProps }: TypeAppProps) => {
    return (
        <MainProvider Component={Component}>
            <Component {...pageProps} />

export default MyApp

I don’t know how to fit NextJs12 into NextJs14 tell me please how doing this

type here

This NextJs 14

import '../assets/styles/globals.scss'
import { MainProvider } from '../providers/MainProvider'
import { TypeComponentAuthFields } from '../shared/types/auth.types'
import { AppProps } from 'next/app'

type TypeAppProps = AppProps & TypeComponentAuthFields

// export const metadata: Metadata = {
//  title: 'Watch movies online',
//  description:
//      'Watch MovieApp movies and TV shows online or stream right to you browser.',
// }

function RootLayout({
}: Readonly<{ children: React.ReactNode }>) {
    return (
        <html lang="en">
            <body className={inter.className}>
                <MainProvider Component={Component}>{children}</MainProvider>

New contributor

Leon Sevast is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.