Next.js 14 Tutorial - 20 - Active Links

Поділитися
Вставка
  • Опубліковано 20 лис 2023
  • 📘 Frontend Interview Course - learn.codevolution.dev/
    💖 Support UPI - support.codevolution.dev/
    💖 Support Paypal - www.paypal.me/Codevolution
    💾 Github - github.com/gopinav
    📱 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
    Active Links
    Styling Active Links

КОМЕНТАРІ • 45

  • @darkxhornet2440
    @darkxhornet2440 6 днів тому +1

    the most underrated and absolutely godly NEXTJS course on YT ....

  • @animatedzombie64
    @animatedzombie64 2 місяці тому +13

    i learnt react around 2019 from this channel. now i'm a software architect, what a journey!!

    • @panjiprawiro1603
      @panjiprawiro1603 17 днів тому

      hy can you explain more what is software architect do? are you still develop website using react in your job?

  • @gamingwolf3385
    @gamingwolf3385 2 місяці тому +10

    Don't use "use client" in layout , all pages inside this layout will be client rendered , its better to create client component contain all your links ,then use pathname inside it ,and let the layout derver rendered

  • @C9Sid
    @C9Sid 2 місяці тому +6

    03:10 If you guys will use startsWith and there will be a home page in your with path '/' Than it will set home and other page active at the same time.
    To avoide this use endsWith instead of startsWith.

  • @pratishjoshi
    @pratishjoshi 3 місяці тому +6

    Props to this guy man. Seriously! So easy to understand! Keep up the good work mate! Subbed, Liked and about to recommend this great of a content to everybody looking to learn NextJS.

  • @yanferaraque1051
    @yanferaraque1051 5 місяців тому +1

    I had issues with my map method, didn't show the data even if it show there was something blank there, then I used the way you did it and worked!!, thank you a lot my friend, I hope one day I can post videos like you to help people from my lenguage.

  • @yuriyula
    @yuriyula 5 місяців тому

    thank you very much! I searched the whole Internet in search of a good solution and found it on your channel

  • @asfnobambu
    @asfnobambu 7 місяців тому +4

    Your style of asking like/subscribe only in the end is very polite! I like it that very much... Thank you for your educatinal efforts.

  • @makobakaweme2821
    @makobakaweme2821 21 день тому

    Thanks for the tuts. Always so helpful.

  • @SidsAnalysis
    @SidsAnalysis 5 місяців тому

    I was not intended to subscribe any English channel because I love understand in hindi.
    But this English channel gives
    1 deep understanding of concepts, 2 clear view of code because of good default zoom level for mobiles,
    3 when I see it in 360p quality it shows clear,
    4 also clear voice,
    5 much available tutorials for node concepts with deep logic in this channel
    6 to the point lessons,
    7 covers each topic,
    8 organized in playlist
    9 so it makes focus on learning, I watched all playlist videos before it.
    10 Now I like it 😁
    So this qualities forced me to Subscribe this channel ❤❤😅😅

  • @JoshuaMusau
    @JoshuaMusau 2 місяці тому

    This guy teaches so well. Give him his flowers, no diddy!

  • @user-ke8er3yc1s
    @user-ke8er3yc1s 3 місяці тому

    thanks bro. your explication is another level .keep going like that bro

  • @Kelvin_Falah
    @Kelvin_Falah 9 днів тому

    nice tutorial,its eazy and simple explanation

  • @HadiAriakia
    @HadiAriakia 5 місяців тому

    Good job mate.

  • @ahmadullahnikzad2850
    @ahmadullahnikzad2850 Місяць тому +1

    the startwith approach has some bug for example the home href starts with / and the other href starts with for example /login then at the same time the home link and the login link have the same style

  • @riyad-appscode
    @riyad-appscode 7 місяців тому

    Great Video 👍

  • @MrSandeeparneja
    @MrSandeeparneja 5 місяців тому +2

    can you talk about how to get the benefits of server side components while still being able to mark the path being visited as active? if we mark the whole layout as "use client" it comes with its drawbacks as layout is a perfect page which can benefit from server side rendering and caching

  • @faizanahmed9304
    @faizanahmed9304 7 місяців тому

    Thanks!🎉

  • @CKNMEDIA
    @CKNMEDIA 7 місяців тому

    Great one

  • @AnoNymous-el6mr
    @AnoNymous-el6mr 4 місяці тому

    hi, if you're working on an app with a multiple groupe pages such as dasboard section, an admin section and a public section, and so to get access to dashboard pages, you have to navigate to /dashboard, and so the links for the dashboard all starts /dashboard/....
    then how would you do ?

  • @kalilinux8682
    @kalilinux8682 4 місяці тому +1

    Wouldn't making layout.tsx client component degrade performance?

  • @sujonpramanik1151
    @sujonpramanik1151 7 місяців тому

    really is was nice sir

  • @ainmosni4319
    @ainmosni4319 Місяць тому +1

    There is nothing wrong with using pathname === link.href instead of Isactive right?

  • @therodri595
    @therodri595 7 місяців тому +1

    can you please make a video on how to handle responsive images without the height and width set to an specific size??? , i just hate how nextjs handles them , i prefer simple html and "object-fijt"

  • @codetechygoon
    @codetechygoon 7 місяців тому

    The important thing with the usepathname is that, it doesn't detect/recognise the hash links.

  • @mghendipato
    @mghendipato 3 місяці тому

    That means one should avoid using "/" for home route, since the "isActive" logic will always mark it as active

  • @codeozz
    @codeozz 4 місяці тому +3

    When we give href='/' to the home page, it automatically becomes an active link, how can we prevent this?
    const navLinks = [
    { name: 'Home', href: '/' },
    { name: 'About', href: '/about' },
    { name: 'Contact', href: '/contact' },
    ]

    • @IsraelWongMX
      @IsraelWongMX 2 місяці тому

      I also have that doubt, were you able to solve it yet?

    • @BeardedSmellyFox
      @BeardedSmellyFox 18 днів тому

      const isActive = pathname.startsWith(link.href) && pathname.length == link.href.length;

    • @killua8762
      @killua8762 10 годин тому

      @@BeardedSmellyFox This won't work for nested links.

  • @chesterxp508
    @chesterxp508 28 днів тому

    GoodJob!

  • @ahmedmrsawy9215
    @ahmedmrsawy9215 3 місяці тому +5

    using use client in layout is not recommended

    • @esr9749
      @esr9749 2 дні тому

      Why it is not recommended?

  • @user-ww4gz7wx4t
    @user-ww4gz7wx4t 2 місяці тому

    So in nextjs you need to check manually using pathname. In react router dom I think you don't have to check manually.

  • @jsiqueiraest
    @jsiqueiraest 7 місяців тому

    goat

  • @marckentevalle7535
    @marckentevalle7535 3 дні тому

    why does it say module not found
    can someone explain please?

  • @divyarajsinhrana6045
    @divyarajsinhrana6045 4 місяці тому

    It is not working for nested route like /about/me etc. paths

  • @bitslayerscorpion8776
    @bitslayerscorpion8776 7 місяців тому +1

    When will this series complete ? How many videos have you planned ?

  • @kimiafarshadnia
    @kimiafarshadnia Місяць тому

    This solution not work for home , when we have '/' not work and home page always have active style