Why Next App gets Reloaded on Route change within NX.DEV Project?

25 views Asked by At

I have used NX.DEV to create my projects and inside it i have created NEXT APP using defualt app route enter image description here Here my-new-app is NEXT app where i have created three components inside component folder and there is one page create user which will be default route created. now this is my page.tsx of home page <div> <style jsx>{ .page { } `}

  <div className="wrapper">
    {/* <Link href="/user">User </Link> */}
    <button onClick={handleCLick}>User</button>
  </div>
</div>

` and layout.tsx is here

> `<html>
>       <Head>
>         <title>OTM</title>
>         <link
>           href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
>           rel="stylesheet"
>         />
>       </Head>
>       <body>
>         <RecoilRoot>
>           <ConfigProvider
>             theme={{
>               hashed: false,
>               token: { borderRadius: 2, fontFamily: 'Inter' },
>             }}
>           >
>             <StyledJsxRegistry>
>               {!['/login', '/forgot-password', '/reset-password'].some(
>                 (element) => pathName.includes(element)
>               ) ? (
>                 <AdminLayout>{children}</AdminLayout>
>               ) : (
>                 <LoginLayout>{children}</LoginLayout>
>               )}
>             </StyledJsxRegistry>
>           </ConfigProvider>
>         </RecoilRoot>
>       </body>
>     </html>` and now here is my **user page.tsx** `<div className={styles['container']}>
  <h1>Welcome to User!</h1>
  <button onClick={handleCLick}>Dahboard</button>
</div> ` and const handleCLick = () => {
router.push('/');

};

Now when i click button on user it redirects me to users page and from there i click button which redirects me to home page but every time route get change my whole application gets reload instead of just component replace Note: I also used Next/link it works also cause same

0

There are 0 answers