Next.js 14 Tutorial - 30 - Conditional Routes
Вставка
- Опубліковано 30 вер 2024
- 📘 Frontend Interview Course - learn.codevolu...
💖 Support UPI - support.codevo...
💖 Support Paypal - www.paypal.me/...
💾 Github - github.com/gop...
📱 Follow Codevolution
+ Twitter - / codevolutionweb
+ Facebook - / codevolutionweb
📫 Business - codevolution.business@gmail.com
Next.js 14
Next.js Tutorial
Next.js 14 Tutorial
Next.js Tutorial for Beginners
Conditional Routes
Conditional Routesin Next.js
Hi all
If you have the blank page issue even if you restarted dev server just delete “.next” folder then re run dev server again and that’s all 👌🏼
To complete the given task, added the default.tsx in @login slot folder
+
make sure to restart the dev server if page.tsx from @login is not working conditionally.
Thank you, this was bugging me out
thank u
You are awesome!
tysmm
thx
In the default.tsx you can use the following:
import LoginPage from "./page";
export default LoginPage;
this will import the LoginPage Export default from your page.tsx, which means that the default.tsx will always be up/to date with the page.tsx. There are scenarios where this may be helpful.
inside default.tsx, we can write this line only ```export { default } from './page'```
good idea! thanks :)
Completed task: by adding default.tsx file in login slot.
Something must have changed in Next.js between the time this video was created to now.
When navigating to /complex-dashboard/archived while isLoggedIn = false, the page will render the header and footer but nothing in between (no 404 message).
Restarting the server and the browser does not change the behavior.
I have same issue, just remove the .next folder and restarting the server and will working fine
@@moathal-zaol8937 Any reason why it started giving 404 error after we deleted the .next folder and re ran npm run dev.
I needed to restart the server with 'yarn dev' to see the 'login' component get rendered. Why?
same thing happened with me as well. Do you now know why ?
@@omkumarsaini692 yeah sometimes when you make changes to certain components like 'layout.jsx' nextjs breaks.....so you need to restart the app.
caching issue bro its fixed in 15 u can use the release candidate version the stable version will be there by the end of the year
i use default.tsx in @login slot but it didnt work, i dont know why i also restarted the dev server but default.tsx is not being displayed
^same here
If Login page is not working on condition, make sure to restart the server.
Navigating to complex-dashboard/archived does not show 404 page, instead header and footer with empty space within appears. Same happens with and without default.tsx in @login. Plzz assist if you know the solution
@@Random-Wonderer I‘ve encountered the same problem ..... tried many ways and even asked ChatGPT but to no avail. If anyone knows how to fix it, please feel free to let me know. Thanks in advance!
it is showing 404 page bcz isLoggedIn false if you change it true and then you set url as archived it will print archived page
Was able to make it work by adding default.jsx file under @login slot.
Note:- This error occured because for "isLoggedInUser" value is "false" which means under "complex-dashboard" route Next.js will try to identify the fallback UI for login slot, and since it was not present "page-not-found" page will get triggered.
while navigating to /complex-dashbaord/archived path, the page worls well when the isLoggedIn is set to true, but the page loads only the header and the footer section when isLoggedIn is set to false without the 404 in between. i'm not sure if this bahaviour is the expected outcome.
Make the file default.js or default.tsx in @login folder to handle the 404 error
3:37 create default.tsx file in archive route then remove that error
It doesn't show the 404 page, but it shows empty...
I had this problem, you need to clear the browser cache and have the same file structure as in github.
I have got the same issue. it doesnt showing 404 error nor Login... only showing header and footer. Did you find the solution?
@@Anshv-p1y same, I cant figure out why is this technically happening
I had to add {login} - for it to work properly - but maybe that would have worked with the default.tsx, too. I don't know.
로그인 Card가 나타나지 않는 경우
1. 서버 종료 후 npm run dev
2. @login 슬롯 폴더에 default.tsx 추가
Please start tailwind css series 😊
the condition is working, but why is nothing displayed even login.tsx?
what if we have a logic in any slot and we have parallel routes, do we need to add the same logic in default.tsx as well? for each unmatched routes?
404 error is not coming for me that you stated in the last instead i see only Header and Footer. Can you please answer why that could have happened? i followed the code along with you
I am not sure about the root cause but when i added default.tsx and deleted it once i started seeing the 404 error
same issue for me
It looks like there will be 2 login pages - one in @login slot and in (auth) section.
its working for me
added a default.tsx page in the @login folder
i did add on the login folder a default.tsx
Isn't there a better way to have a page.tsx and a default.tsx without duplicating the whole code?
import page inside the default.tsx and it will work
To complete the given task
done adding the default.tsx in @login slot
you are really great sir😄
task Completed Sir and Noted in Notes ,Thank you soo much . Waiting for Upcoming Class.
add default.tsx in @login
it does not works
thanks