Next.js 13 Crash Course Tutorial #11 - Client Form Component

Поділитися
Вставка
  • Опубліковано 26 сер 2024
  • In this Next 13 tutorial series, you'll learn the basics of Next.js to make a simple project, using the new app router & server components.
    🚀🥷🏼Access the entire Next.js 13 Masterclass course on Net Ninja Pro:
    netninja.dev/p...
    ➡️ Use promo code NEXTNINJA50 for 50% off!
    📂🥷🏼 Access the course files on GitHub:
    github.com/iam...
    📂🥷🏼 CSS File from course files:
    github.com/iam...
    💻🥷🏼 React Tutorial:
    netninja.dev/p...
    🔗🥷🏼 Next.js docs - nextjs.org/docs
    🔗🥷🏼 CSS modules in Next.js - nextjs.org/doc...
    🔗🥷🏼 VS Code - code.visualstu...

КОМЕНТАРІ • 57

  • @IbrahimAli-ve9er
    @IbrahimAli-ve9er Рік тому +5

    One of your gangs waiting for Tutorial 12 from Turkey. Thank You

  • @jamezjaz
    @jamezjaz 10 місяців тому +10

    You're something else, man.
    Great job here, well done!

    • @NetNinja
      @NetNinja  10 місяців тому +1

      Thanks :) that means a lot

  • @velmar.wolfdream
    @velmar.wolfdream 11 місяців тому +13

    I received "Error: NextRouter was not mounted."
    The way I fixed it was I changed "import { useRouter } from 'next/router';" (it was automatically imported that way for me, it might be for you, too) to "import { useRouter } from 'next/navigation';"
    A very easy thing to overlook.

  • @Sasuke-yv5yk
    @Sasuke-yv5yk 2 місяці тому

    Excellent tutorial my man! Keep up the good work.

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

      Glad you liked it!

  • @user-ze8tz9no8l
    @user-ze8tz9no8l 7 місяців тому +1

    I get a sense anticipation with your explainations 😅 its really engaging

  • @yassinebouchoucha
    @yassinebouchoucha 10 місяців тому

    @14:00 was wrapping my head for hours about router.push re-validation!

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

    Exactly the info I was looking for

  • @user-ze8tz9no8l
    @user-ze8tz9no8l 7 місяців тому +1

    My ticket shows straight away 😂

    • @commentator2407
      @commentator2407 6 місяців тому

      it doesnt for me; even after using refresh()

  • @badis6717
    @badis6717 11 місяців тому

    I believe there is a simple way to even make the form server side, but then i will doubt why i use react in the first place hhh.
    By the way, great content 👌 sadly in my country, we can't pay online so i will give you a like ❤

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

    how to show #contact section of a long page, after submitting form using server actions with js disabled. #contact section is at last of the page.

  • @sagarprajapati-bk3hm
    @sagarprajapati-bk3hm 10 днів тому

    thanks

  • @dannydiscovers
    @dannydiscovers 9 місяців тому

    what do you do when you have a 3rd party app like mailchimp with a form. I keep getting cors errors

  • @claudiocl8937
    @claudiocl8937 8 місяців тому +1

    It can´t be that you have to refresh all routes, there has to be a way to filter that down :D

  • @Sasuke-px5km
    @Sasuke-px5km 6 місяців тому

    Can we use SWR for this also?

  • @duccinidev
    @duccinidev 9 місяців тому

    Why the browser does not send a new request for the tickets page if we disable cache?
    "It's being done by browser side is so vague!

  • @snehel1586
    @snehel1586 6 місяців тому

    somehow router.refresh() isn't working for me? i still have to refresh the tickets page every time a create a new ticket to view it in the ticket list. any work around?

  • @osoningliztili6708
    @osoningliztili6708 9 місяців тому

    thank you

  • @alexg7282
    @alexg7282 Рік тому

    Thanks a lot.

  • @eliyahutarab4862
    @eliyahutarab4862 Рік тому +1

    GOAT

  • @lakshitsagar6299
    @lakshitsagar6299 10 місяців тому

    can a server component be part of a client component??

  • @blankslate6393
    @blankslate6393 Рік тому +2

    Trivia: In the github repo #11 , the `Body` lable is still `Title`.

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

    How did you access the route '{your_url}/tickets/create' when you have the '{your_url}/tickets/[ticketId]' dynamic route?

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

      we created a new folder named "create" under tickets folder and we also have "[id]" folder which works as dynamic route, so both are different routes.

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

    So that's a client-side data fetching, isn't it?

  • @scars5019
    @scars5019 10 місяців тому

    can someone help me please since i am getting a 400 error request in the console on my browser when i click on submit ticket.

  • @alinadorofeeva8903
    @alinadorofeeva8903 11 місяців тому

    need use 'next/navigation' for useRouter

  • @commentator2407
    @commentator2407 6 місяців тому +1

    @net ninja
    the router.refresh() doesn't work for me
    i have to manually refresh the page to see the updated ticket list

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

      check your revalidate value if its 0 in the TicketList.jsx file! that was the fix for me

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

      @@justinkim2330 this is not the solution, mine works no matter revalidate is 30 or 0, @commentator2047 found solution later in comments, he reshuffled push and refresh, i.e. first push then refresh.

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

    Hey bro!
    I did follow everything as you are teaching in this tutorial series. But in this lesso, I got an error. Basically, this is seems to be because, I'm using the latest Next.js version which is known as Next.js v14. I'll write down the error what I'm getting whem I'm submitting the form to create a new ticket!!!
    Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server".
    This is the error I got. Please currect me if you can
    Thank you!!!

  • @abdullahaltabbal9936
    @abdullahaltabbal9936 10 місяців тому

    Thank you very much for the amazing videos, I have a question. Why didn't you just do that with the adding button? Is there a difference?
    {isLoading ? 'Adding...' : 'Add'}

    • @fanssolutionsug
      @fanssolutionsug 10 місяців тому

      No difference he just used another method of optional rendering &&, u could use ternary operator ?: or if newbie you can even use "if else"

  • @jhjhj2172
    @jhjhj2172 11 місяців тому

    till 8:15

  • @Stallion45
    @Stallion45 Рік тому +1

    This is great..., one issue however. When I submit a ticket it does not show the new ticket on the tickets page unless I manually refresh the page. I've copied your code exactly. What might be preventing the refresh?

    • @tickshot
      @tickshot Рік тому

      13:03

    • @GregPixel
      @GregPixel 11 місяців тому

      I have the same issue, even if I have added "router.refresh()" it does not work. Does someone has an idea?

    • @passioncorners
      @passioncorners 9 місяців тому +3

      Make sure on your TicketList component that 'revalidate' is set to 0 like this
      `revalidate: 0`

    • @Yi-YingKo-ig4he
      @Yi-YingKo-ig4he 8 місяців тому

      will it makes more sense to refresh after the push?

    • @commentator2407
      @commentator2407 6 місяців тому

      its 0 for me; still the same issue@@passioncorners

  • @aryanpanja2074
    @aryanpanja2074 9 місяців тому

    9:02 / 14:27

  • @killergaming3206
    @killergaming3206 Рік тому

    how did you created the "/ticket" endpoint for pushing a new ticket into the .json file ? it is not covered.

    • @maskman4821
      @maskman4821 11 місяців тому

      You have to replaced json-server with database such as firebase, appwrite, mongodb, etc.

    • @manishtaker8622
      @manishtaker8622 11 місяців тому

      it is working fine on json-server@@maskman4821

    • @manishtaker8622
      @manishtaker8622 11 місяців тому

      check e.preventDefault();

  • @JW-ps8vp
    @JW-ps8vp Рік тому

  • @programmingwithnit5308
    @programmingwithnit5308 Рік тому

    Ok good

  • @Ashish-ns2iv
    @Ashish-ns2iv Рік тому

    please cover angular 16. since your angular play list is 7 year old. Thank u so much. in advance.

  • @appstuff6565
    @appstuff6565 10 місяців тому

    Hey there Net Ninja, thanks for this. I wanted to ask how can i persist the typed in value in input field? EX: i have a page.tsx in signup folder -> signup/page.tsx , this one has the form in it and is server component. When i hit the sign up button, it goes to signup/route.ts with method post in . The route.ts for signup handles all the database management plus return NextResponse.redirect() etc as required. This is also server side. Both are server side. I just want to know how can i persist the input typed value so when i click the signup button i need to persist that typed in value and not make it disappear?