Next.js 14 Tutorial - 7 - Dynamic Routes

  Рет қаралды 245,586

Codevolution

Codevolution

Күн бұрын

Пікірлер: 129
@technomad123
@technomad123 3 ай бұрын
For anyone working with the latest version of next.js more specifically next.js 15 or above will now need to know that all dynamic API's are asynchronous, thus for any operation requiring accessing the fields of the params or searchParms needs to be handled as an asynchronous operation. Example: Before: function ProductID({ params, }: { params: { productId: number } }) { const { productId } = params return Product ID: {productId} } export default ProductID After: async function ProductID({ params, }: { params: { productId: number } }) { const { productId } = await params return Product ID: {productId} } export default ProductID you will now need to await the params object as well.
@MAR-kh4ed
@MAR-kh4ed 3 ай бұрын
thanks brother !! Was searching for the solution
@technomad123
@technomad123 3 ай бұрын
@MAR-kh4ed you're welcome😄
@xboy2374
@xboy2374 2 ай бұрын
thanx bro
@technomad123
@technomad123 2 ай бұрын
@@xboy2374 you're welcome
@Jamie_1144
@Jamie_1144 2 ай бұрын
Life saver, spent ages trying to fix this error then read your comment! Thank you!
@billb1365
@billb1365 5 ай бұрын
Outstanding tutorial! I first watched the lessons and now watching a second time while coding in parallel. Thanks for developing such exceptional content.
@Codevolution
@Codevolution 2 ай бұрын
Thank you for the support!
@ONEHLOFIOCHIOCHEME
@ONEHLOFIOCHIOCHEME 5 ай бұрын
Vishwas is a gifted teacher and educator. You are a gift to mankind dear Vishwas.
@uquantum
@uquantum 8 ай бұрын
Thanks so much❤ I’d moved so quickly to astro (ssr) a couple years ago, but now I have a next.js project, so I really appreciate your presentation style and the content to get me up to speed.
@AjikwuC.Wilson
@AjikwuC.Wilson Жыл бұрын
Thanks. I'm following this course as soon as they drop. Promise to finish it with you. This is great
@Usama-Tanoli
@Usama-Tanoli 10 ай бұрын
so as you might finished this could you tell me how is this
@NishantCosmos
@NishantCosmos 27 күн бұрын
Wow your explanations are clear as crystals. I love it. Thankyou for these tutorials.
@SupunNimantha
@SupunNimantha 2 ай бұрын
When you destructure route parameters, it's better to have an interface defined to accept route parameters specific to that page especially when you have multiple properties. It's much clearer and the code is neat.
@shubhaverma5697
@shubhaverma5697 7 ай бұрын
Wow. Amazed by the content you provided in 7 minutes. I must have tried to learn about dynamic routes from so many resources, never quite understood it until now.
@euroclydon7883
@euroclydon7883 Жыл бұрын
Your explanations are top notch
@omozemojeaugustine3529
@omozemojeaugustine3529 9 ай бұрын
Am following the series thanks for breaking this down to this level
@md.Alamin-ej6ro
@md.Alamin-ej6ro 8 ай бұрын
Damn THIS was too good, it helps me a lot i was searching for this type of content but everyone just explained it in a more difficult way , anyway it was damn good to understand the basics of the dynamic routes. Thanks a lot..
@riavi
@riavi 11 ай бұрын
Thanks! This cleared up what my instructor meant by dynamic routes, I didn't get it in class.
@latifurrahman2648
@latifurrahman2648 11 ай бұрын
this course helps me very much. you are the best instructor
@misalambasta
@misalambasta 5 ай бұрын
Those who are wondering where the params come from. The folder name [productId] will pass as a params in page.tsx file of the same folder.
@kuldeepdebnath4787
@kuldeepdebnath4787 2 ай бұрын
BEST TUTORIAL OUT THERE. TYYSMM
@koketsophiri1753
@koketsophiri1753 3 ай бұрын
Gold mine of a course😭❤
@syedakashish5913
@syedakashish5913 Жыл бұрын
explanation is so good.And it seems like john the don it teaching.
@bhn1997
@bhn1997 11 ай бұрын
Thanks for your guides. Exactly what I wanted to render!
@emmanuelkpogo9319
@emmanuelkpogo9319 6 ай бұрын
Great tutorial. Very comprehensive.
@auricaputri7664
@auricaputri7664 7 ай бұрын
great tutorial video, my first day learning your course!!
@isagive
@isagive 6 ай бұрын
תודה רבה, הסבר ענייני ומקצועי. 👍
@inibudi4233
@inibudi4233 Жыл бұрын
Thank you for step-by-step tutorial, very helpful
@thespiritninja11
@thespiritninja11 6 ай бұрын
THIS HELPED SO MUCH! Thank you 🫡
@shresthagaurab2193
@shresthagaurab2193 Жыл бұрын
Thanks u so much step by step , it's very helpful
@jeffreyndukwe3869
@jeffreyndukwe3869 Жыл бұрын
You are doing a great and wonderful job. Nice teaching
@yinonelbaz5309
@yinonelbaz5309 Жыл бұрын
You are doing a great and wonderful job!
@GREENTEACODES
@GREENTEACODES 3 ай бұрын
Thank you brother for such amazing content
@rohit_dev
@rohit_dev Жыл бұрын
I am going to finish this series with you 🙌
@josatienganh
@josatienganh 8 ай бұрын
Thank you so much for the guide! ❤
@sejeminecraft1
@sejeminecraft1 11 ай бұрын
Thank you so much. Short and precise, extremely helpful!
@Ezzgamezzz
@Ezzgamezzz 6 ай бұрын
Well explained 👍🏻👍🏻
@joja2174
@joja2174 Жыл бұрын
bro explained a 2 hours lecture in 7 mins
@king_james_official
@king_james_official 7 ай бұрын
no
@mzohaib27
@mzohaib27 4 ай бұрын
actually bro is explaining very good... those who took 2 hours for this.. they are paid courses.... their goal is only to take money.... nextjs course... then nextjs advanced course... then nextjs project learning course etc..... that's why they are taking 2 hours on this.... bcz if they teach everything in one course who will buy second...
@joja2174
@joja2174 4 ай бұрын
@@mzohaib27 imo paid courses are very focused on giving EVERYTHING the good bad and ugly, the useful, useless and good to know, so they are not time efficient but definitely worth it, at least the good ones some things they tend to over explain which why i watch channels like this, straight to the point
@jonathanguerrero5991
@jonathanguerrero5991 11 ай бұрын
Dynamic routs information start at minute 4:00 all previously said is not dynamic routes.
@DushyantJoshi
@DushyantJoshi 11 ай бұрын
Just Awesome. Thanks for this.
@GerardoAG
@GerardoAG 6 ай бұрын
you are a genius bro, thaks
@yipmong
@yipmong 9 ай бұрын
Sir, words can not express our appreciation to your short and fully concised tutorial, we are very grateful for this. i watched a 3 hours tutorial but couldnt understand fully but yours of less than 10 mins i feel like a pro in this thank you so much for all you do sir❤❤❤
@최재혁-k6j
@최재혁-k6j Жыл бұрын
so useful teaching! Thanks
@ViniciusRodrigues-st8mw
@ViniciusRodrigues-st8mw 4 ай бұрын
Thank you very much Sir!
@aakashyadav6228
@aakashyadav6228 Жыл бұрын
Bro, please continue with the series.
@TheKauddin
@TheKauddin 2 ай бұрын
Where did i mistake? export default function ProductDetails({params}:{ params:{productid:string}; }) { return Product Details of {params.productid}; }
@survivordaqwv9002
@survivordaqwv9002 2 ай бұрын
import { NextPage } from "next"; interface Props { params: { productId: string; }; } const Page: NextPage = async ({ params }) => { const { productId } = await params; return Product {productId}; }; export default Page;
@elenak2528
@elenak2528 Жыл бұрын
Thank you! Where did you find it? There is no this info in documentation I think. Only with the help of your video I managed to finally do dynamic routes ( params especially are never mentioned in documentation, or I am stupid I don;t know)
@omexaapp3062
@omexaapp3062 8 ай бұрын
certainly u are the best.
@asifnewaz477
@asifnewaz477 11 ай бұрын
Thanks bro! You are so cool!
@rickyanchores4464
@rickyanchores4464 Жыл бұрын
Great tutorial!!
@ShivamSahu-l6c
@ShivamSahu-l6c 3 ай бұрын
Amazing
@2u841r
@2u841r 5 ай бұрын
Thank you.
@andrewberrio7374
@andrewberrio7374 11 ай бұрын
Thank you sir
@luisr2662
@luisr2662 6 ай бұрын
Amazing!
@Yuuffyy
@Yuuffyy Жыл бұрын
Hey Codevolution & watchers, In your dynamic routes we're using params. Is there any difference to your usage and type declaration compared to NextJS useParams für dynamic routes? In their docs they create a variable with const params = useParams (and import it). Thanks for your videos!
@beybell
@beybell 10 ай бұрын
If someone gets an error, the id does not appear in the text on the page or next shows an error, check whether you wrote the ID correctly in the ProductId folder. In the folder name, the first letter I must be capitalized product Id
@Kevin-ft1xe
@Kevin-ft1xe 10 ай бұрын
Thanks mate
@MucahitCanbey
@MucahitCanbey Жыл бұрын
Thanks ✨✨
@osaka-ben9291
@osaka-ben9291 Жыл бұрын
thank you so much ! i was struggling with NextJs router specially with the 14.0 version because we're not using the folder "pages" anymore if i get it right.
@wojteeh
@wojteeh 10 ай бұрын
Very useful, thanks ;)
@NguyênNguyễnTrung-r3x
@NguyênNguyễnTrung-r3x Жыл бұрын
Thank you!
@tensorbaba7687
@tensorbaba7687 6 ай бұрын
why do we destructure params in paramerters of function component?
@minseongkim3278
@minseongkim3278 6 ай бұрын
This video must be accepted by official docs
@mohitrathore8808
@mohitrathore8808 Жыл бұрын
Wonderful, keep going
@nahar830
@nahar830 Жыл бұрын
Thanks
@Regiomer
@Regiomer Жыл бұрын
Does this work with js also? It renders only the "404 page not found" component in my case
@saintrivers962
@saintrivers962 11 ай бұрын
Yeah, I'm having the same problem.
@Pipu748
@Pipu748 8 ай бұрын
love it
@sahandsepidar4089
@sahandsepidar4089 Жыл бұрын
i only tought the only way to get the paramd is using hooks , i didnt know about params ; thank you
@shouryadey3911
@shouryadey3911 3 ай бұрын
What if I need some pattern like this a-to-b-journey. where a and b can be anything. would having a folder with name [src]-to-[des]-journey works?
@NishantCosmos
@NishantCosmos 27 күн бұрын
Did you found out?
@its_Akhtar
@its_Akhtar 6 ай бұрын
Thanks a lot
@kevinchittilapilly8221
@kevinchittilapilly8221 11 ай бұрын
Thanks for the lecture. I have a doubt. How can I add a check so that only if the productId is a number, I navigate to the right page. But if the user enters something like product/temp it does not navigate to the productid page
@ThePressend
@ThePressend 3 ай бұрын
import useRouter, then destructure your dynamic id, and check for this whether is number using Number.isInteger(), if not redirect to another url
@tsmusic9587
@tsmusic9587 Жыл бұрын
NICE video
@adityarajaram3124
@adityarajaram3124 Жыл бұрын
I have question while deploying in next js 14 with app router (Dynamic Route) it's not supported. Do you know any way?
@iqbalali3341
@iqbalali3341 Жыл бұрын
I also have the same problem, have you found a solution?
@victoragese
@victoragese Жыл бұрын
Same here
@HassanAKhann
@HassanAKhann 9 ай бұрын
Saviour
@mxttw
@mxttw 9 күн бұрын
thanksssss
@bj0urne
@bj0urne 9 ай бұрын
My VS Code doesn't automatically format my code when I save the file like yours does... Is that an extension you're using?
@EzequielGrigolatto-lg6mz
@EzequielGrigolatto-lg6mz 9 ай бұрын
You can use and configure prettier for that
@harshitshrivastava114
@harshitshrivastava114 9 ай бұрын
why my params.productID is showing undefined in console.log
@gboyegaoluwatobiloba8585
@gboyegaoluwatobiloba8585 6 ай бұрын
seems using typescript is a hassle
@ailton.duarte
@ailton.duarte 7 ай бұрын
my layout is not working in productId, do u know why?
@JagadishL-wj6sn
@JagadishL-wj6sn 9 ай бұрын
How do you handle 404 page for dynamic routes
@AlexTLOU
@AlexTLOU 8 ай бұрын
well, lets say you are searching for that id in the database and returning its properties, then yuo can do a conditional rendering to see if your api returned the data or returned a 404 error!
@theangelofspace155
@theangelofspace155 Жыл бұрын
But what happen of we try to access a outOfRange dynamic route? Do we need to build that logic so if a user is trying to go to /[100] but we only have 50 resources? Or will nextJS render a 404 - not found?
@HimanshuGogoi
@HimanshuGogoi Жыл бұрын
u need to manually redirect it to not found else it will still attempt to show the page
@HassanMehboob-ij1cq
@HassanMehboob-ij1cq 11 ай бұрын
How I can get id in nested component?
@gettingoverit__
@gettingoverit__ 6 ай бұрын
how to do it programmatically
@navjotsingh5303
@navjotsingh5303 4 ай бұрын
with dynamic routes i could't able to make build with static export can anyone help me with this
@zohaibafridi3522
@zohaibafridi3522 Жыл бұрын
will it work on build?
@gabrielsouza4483
@gabrielsouza4483 10 ай бұрын
Why when im ussing output: export I got the error "Page "/[ID1]/[ID2]" is missing "generateStaticParams()" so it cannot be used with "output: export" config." ??? I dont have all possible values to ID2 and ID2 to generateSTtaicParams
@EzequielGrigolatto-lg6mz
@EzequielGrigolatto-lg6mz 9 ай бұрын
I'm getting the same issue, were you able to solve it?
@gabrielsouza4483
@gabrielsouza4483 9 ай бұрын
@@EzequielGrigolatto-lg6mz the """"fix""" is downgrad tô 13.4.9 , apparently next 14 release with this bug but never fixed
@EzequielGrigolatto-lg6mz
@EzequielGrigolatto-lg6mz 9 ай бұрын
@@gabrielsouza4483 thanks for your quick answer! unfortunately downgrade next version is not possible on my case, I'll look for other options then
@gabrielsouza4483
@gabrielsouza4483 9 ай бұрын
@@EzequielGrigolatto-lg6mz I tried almost everything , almost for two weeks, but if u find a solution tell me
@rahmannurudin5003
@rahmannurudin5003 Жыл бұрын
where's _app module in newest next.js version?
@behroozbk
@behroozbk Жыл бұрын
best
@MALI-gj8sk
@MALI-gj8sk 4 ай бұрын
But NextJs docs says folder name should be like this: pages/products/[id].js.
@CelliumsBurner
@CelliumsBurner 3 ай бұрын
You’re using the pages router. You should be using the app router. You’re looking at the wrong docs
@yellhtetnaing2245
@yellhtetnaing2245 Жыл бұрын
waiting for next pieces
@worldoflanguages1043
@worldoflanguages1043 7 ай бұрын
what;s this error in console Warning: Extra attributes from the server: cz-shortcut-listen
@chesterxp508
@chesterxp508 Жыл бұрын
GoodJob!
@selvamkarthik9605
@selvamkarthik9605 Жыл бұрын
😊
@Kmkn308
@Kmkn308 Жыл бұрын
waiting more videos
@manuelrosalesmaquieyra9687
@manuelrosalesmaquieyra9687 8 ай бұрын
bestia animal idolo
@ObjectiveTruth-zm3hi
@ObjectiveTruth-zm3hi 8 ай бұрын
isn't TypeScript a waste of time ?
@warriors_edge
@warriors_edge 8 ай бұрын
fuckin amazing, thank you
@gorkemgok9313
@gorkemgok9313 10 ай бұрын
The voice is AI. I am sure.
@AlexTLOU
@AlexTLOU 8 ай бұрын
nah he is just Indian 🤣🤣🤣🤣🤣🤣
@anasouardini
@anasouardini 7 ай бұрын
BRO, you've been repeating the same thing in the last 3 videos
@tienhuynh2435
@tienhuynh2435 6 ай бұрын
respect sir
@jesssdad
@jesssdad 4 ай бұрын
For me it didn't work as it didn't display the product ID after 'Details about product'. For anyone having the same issue first thing to check is that the folder is named [productId], mine was [productID] and it couldn't match/find the page. So the big lesson here is that next.js is case-sensitive. The only way I could work out how to debug it was to use postman and look at the actual response from the server which contained the following content (buried in a HTML tag) "{\"children\":[\"Details about product \",\"$undefined\"]}] 5:[\"productID\",\"1\",\"d\"] 7:D{\"name\":\"RootLayout\",\"env\":\"Server\"} 8:D{\"name\":\"NotFound\",\"env\":\"Server\"} 8:[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}" In other words the server simply returned 200 = OK as a status on a 404 page. I'm guessing this type of issue is handled in a later video?
@CelliumsBurner
@CelliumsBurner 3 ай бұрын
If you used your common sense you’d know that js is a case sensitive language.
@yogita868
@yogita868 10 ай бұрын
I have this created this file structure in Next js version ->14 project\[[id]] Inside page.tsx I have this code-> 'use client'; import PathwayContainer from '@/components/Pathways/PathwayContainer'; const PathwayPage = () => { const clientID = '06375fa6-999a-46a8-9d80-12e41e76aa52'; return ( ); }; export default PathwayPage; This clienID I would fetch from useselector later as of now i keep code like this. and this is the component for PathwayContainer. 'use client'; interface IPathwayContainerProps { fetchClientProjects: (clientId: string) => Promise; clientID: string; } const PathwayContainer: FunctionComponent = (props) => { const { fetchClientProjects, clientID, } = props; const [loading, setLoading] = useState(false); const [activeProjectList, setActiveProjectList] = useState([]) useEffect(() => { const getActiveProjectList = async () => { try { setLoading(true); const projectInfo = await fetchClientProjects(clientID); setActiveProjectList(projectInfo); } catch { } finally { setLoading(false); } } getActiveProjectList(); }, [clientID]) return ( {activeProjectList.map((activeProject, index) => ( {activeProject.name} ))} ); }; export default connect(() => ({}), { fetchClientProjects: actions.clients.fetchClientProjects, })(PathwayContainer); whevaver user clcik on this link which i have crated using clientID is not changed but my useeffect code runs again and again whenver user click on links. same code works fine in react. How can i solve this issue.please help.
@igorluyz_
@igorluyz_ Жыл бұрын
You are doing a great and wonderful job!
@adityarajaram3124
@adityarajaram3124 Жыл бұрын
I have question while deploying in next js 14 with app router (Dynamic Route) it's not supported. Do you know any way?
@Txushin
@Txushin 10 ай бұрын
Thanks
@brunelleagboton161
@brunelleagboton161 4 ай бұрын
Thanks a lot
Next.js 14 Tutorial - 8 - Nested Dynamic Routes
4:10
Codevolution
Рет қаралды 155 М.
Learn Next.js 15 in 1 hour - Beginner Tutorial
59:25
Codevolution
Рет қаралды 108 М.
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Next.js App Router: Routing, Data Fetching, Caching
14:32
Vercel
Рет қаралды 344 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 949 М.
API vs SDK: What’s the Difference?
3:42
Klippa
Рет қаралды 17 М.
Transformers (how LLMs work) explained visually | DL5
27:14
3Blue1Brown
Рет қаралды 4,6 МЛН
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 196 М.
NVIDIA CEO Jensen Huang's Vision for the Future
1:03:03
Cleo Abram
Рет қаралды 542 М.
Next.js 14 Tutorial - 5 - Routing
7:46
Codevolution
Рет қаралды 241 М.
Next.js 14 Tutorial - 9 - Catch all Segments
8:05
Codevolution
Рет қаралды 153 М.
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН