Next.js 13 - Building a Todo App

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024

Комментарии • 101

  • @TuomoKankaanpaa
    @TuomoKankaanpaa  Год назад +6

    If you are getting "cannot fetch" error or otherwise trouble connecting to the server in your localhost, you can try converting the address from localhost -> 127.0.0.1 and that should help.
    Thanks for Raul for figuring this out! 🙌

  • @blossomdoom7609
    @blossomdoom7609 Год назад +1

    Hey, I did the same thing but the refresh call isnt working. from my research on the next docs its because my fetch for the server component does have "{cache: "no-store"}" and so i have to call a revalidate function to make a new server component request and then refresh.

  • @Yarkaha
    @Yarkaha Год назад +3

    Really Tuomo you made me understand nextjs 13 better than other nextjs RUclips tutorials. Thank you 🙏

  • @BarisPalabiyik
    @BarisPalabiyik Год назад +2

    I feel like, they should have make the app folder client by default and make the functions server side if they have async on them. Going out and saying "Hey guys, all of yours hooks and libraries will not work in your main folder anymore, unless you put "use client" up top", was a bold, but a problematic way I feel like, I loved layouts but let us opt-in for server components. AlsoTuomo can you make a video where, you mutate data with prisma.orm inside the components without the api layer? I wanna see how you can do the post put delete update stuff with client side interactivity from the client component, is there any easy way to trigger stuff in backend in the component with just client side interaction I wonder.

    • @SatyamSingh-rq2tc
      @SatyamSingh-rq2tc Год назад +1

      Yep. Next.js 13 feels like a whole new framework. I don't know how to feel about "every component is a server component by default unless stated otherwise". Migration from Next.js 12 is going to be very difficult for most of the projects.

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад +2

      Thanks for the comment! That is definitely something I am looking into (mutating data with prisma or using firebase) and actually not yet sure what the best way to accomplish that is. At the moment I am thinking that using just api routes for post/put/delete is the most convenient way but tbh gotta look more into this!

  • @yhr4052
    @yhr4052 Год назад +2

    We've been seeing you a lot lately, Tuomo 😁
    Always a pleasure to watch your videos!

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Glad to hear! Yeah it’s nice to upload more lately!

  •  Год назад

    what about using relative url paths for API calls if the API handlers are local?

  • @kazz94
    @kazz94 Год назад +1

    This is so interesting, especially the refresh() part. But what if you have the TodoList in one page, and the AddTodo in another one? How do you refresh the List from the Add page? Because router.refresh() refreshes the current page, but how can you refresh a different page?
    Thanks in advance! This is blocking my progress so hard xD

    • @4dev346
      @4dev346 Год назад +1

      Once you navigate to another page, that's already a refresh/reload. You don't need to specify a new refresh.

  • @tamildevtutorial
    @tamildevtutorial Год назад

    I have a one login from inside my client component. I want to call my login api with my secret keys. Can't import my secret keys in my client component So where I put the api request

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      You are right, you should not put api keys to client components. You can create an api route for example that handles the login. Check out my video about nextauth, there we do a login funcrionality. Hope that helps!

  • @AmeerHamza-nh5nf
    @AmeerHamza-nh5nf Год назад

    @TuomoKankaanpaa WHY are we using 'POST' method instead of 'PUT' or 'PATCH' for updating the checked behaviour of checkbox ???

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      You could definitely use PUT or PATCH too, that's good point!

  • @4dev346
    @4dev346 Год назад

    Is rewrite ready for production?

  • @aramabdulrahman2087
    @aramabdulrahman2087 Год назад +1

    best as always thanks...

  • @JuanPPPaez
    @JuanPPPaez Год назад

    Ty, I was losing my mind with refresh stuff : )

  • @aaymankhalid9997
    @aaymankhalid9997 Год назад

    I have a question as I am trying to learn next js,is the use of API really necessary to make this app?

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      I think it's a great option for this app but surely you could save things in memory or something like that :)

  • @sheeraz-ud-din4948
    @sheeraz-ud-din4948 Год назад

    I have download repository, but when i install it. through this command,
    >>yarn install>>
    i got error
    yarn : The term 'yarn' is not recognized as the name of a cmdlet, function, script file, or operable
    program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
    again.
    At line:1 char:1
    + yarn install
    + ~~~~
    + CategoryInfo : ObjectNotFound: (yarn:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
    Kindly guide.

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Yarn is a package manager like npm, you need to first install it, see here for more info: yarnpkg.com/getting-started/install

    • @sheeraz-ud-din4948
      @sheeraz-ud-din4948 Год назад

      @@TuomoKankaanpaa okay. Sir. I have installed. And it is running. Thnx for your kind response.

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      @@sheeraz-ud-din4948 Great!

  • @vzdev9978
    @vzdev9978 Год назад +1

    Nice ❤

  • @siddharthponnapalli4346
    @siddharthponnapalli4346 Год назад

    I've been doing it the exact same way as you've taught , but, when I check the box, there's no change in the api. Am I missing something?

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Sorry to hear that! Not sure what the problem is, I’d first check with chrome dev tools that the request to the api is fired when checking the box and if not, then it must be some frontend problem. Hope this helps!

    • @simonfeldermann4561
      @simonfeldermann4561 Год назад

      I had an similar Problem. First i checked the state od the todos on the api and they changed but i had no change on the frontend. Next step was to console.log the ids. They had been different... Culprit was fetch in my case. Somehow the requests had been cached and i added "mode: 'no-cache'" to the request and that seemed to fix the Problem.
      I hope you can debug what went wrong :)

  • @saadshaoor7670
    @saadshaoor7670 Год назад

    Not for beginners as nothing have been shared regarding setting of environment

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Thanks for your comment! What would you have liked to see more?

  • @sunnanabdullah1413
    @sunnanabdullah1413 Год назад

    I found an error in connecting api with my local server

  • @faruksardar8829
    @faruksardar8829 Год назад

    Hii Tuomo , I triend the same But I'm getting an error,
    "Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead."

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Hi! Make sure you have the data fetch method exactly as it is in the video. Maybe you are missing .json() from the end -> "return todos.json()"?

  • @Grishopping
    @Grishopping Год назад

    Thanks for sharing... Friend, do you have a discord channel?

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад +1

      Glad to have you here! Unfortunately I dont atm, maybe sometime in the future

    • @Grishopping
      @Grishopping Год назад +1

      ​@@TuomoKankaanpaa Greetings, thanks for answering.... Sorry, my English is very bad, I did not understand "Unfortunately I dont atm"
      (ATM???) I'm from Venezuela I use a translator but your videos are to the point and have been very useful.... DISCORD is a free platform and it serves to give feedback to your community.... I hope to see your first 10,000 sub heading to 100,000 sub and many more many blessings
      att, Jose Grillo
      ESPAÑOL
      Saludos gracias por contestar.... Disculpa mi ingles es muy malo no entendi "Unfortunately I dont atm"
      (CAJERO AUTOMATICO???) soy de Venezuela uso traductor pero tus videos van al grano y me han sido de mucha utilidad.... DISCORD es uan plataforma gratuita y sirve para hace feedback con tu comunidad .... Espero ver tus primeros 10,000 sub rumbo a los 100.000 sub y muchos mas muchas bendiciones
      att, Jose Grillo

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад +2

      @@Grishopping Great to hear that you like the videos and thank you! I don't have a discord at the moment. Maybe I will create a discord server some time in the future. Greetings to Venezuela! :)

  • @y4yaoo155
    @y4yaoo155 Год назад

    Hi please tell how to implement update functionality in the app.please explain.

  • @p4plumbing221
    @p4plumbing221 Год назад

    not understand how u run api on local server

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      I have a link to the api repo code in the video description. You can open that, then clone that repo, open it in your vscode and run yarn install and yarn start (or yarn dev) and then you will have the api running locally. The address will be something like localhost:3000, it will be displayed in the terminal after you run yarn start (or yarn dev)

  • @rafiali7315
    @rafiali7315 Год назад

    how to deploy this project on vercel

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      It should be deployable to vercel as any nextjs app! I have a video on the channel teaching how to deploy app to vercel, you should check that out!

  • @patite3103
    @patite3103 Год назад

    Awsome video! How do I start with Next 13? You didn't show how to create the application? How do I install Next 13? Should I install first the old version and then update it? I cannot even start! When to use "npm run dev" and "npm run build" ? What package should I install to use "npm"? Thanks

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад +1

      When you create new project with create next app, it will automatically have version 13. Here is easy steps on how to get started by setting up the project: beta.nextjs.org/docs/getting-started

  • @struffios
    @struffios Год назад

    👍👍👍👍👍

  • @janux.
    @janux. Год назад

    Hello, nice video 📸, one thing though , why your network tab in inspect is flooded with api request when you do 1 request to the server.

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      It's like that just in development mode and because I'm using the dev server. In production it won't be like that

  • @sabeeha4840
    @sabeeha4840 Год назад

    how to use the api?

  • @InspiringWiseWords
    @InspiringWiseWords Год назад

    Thank you so much for helping the community of next js 13. Learnt so much from your video

  • @uetianafridi
    @uetianafridi Год назад

    this video is awesome. plz make some small projects and implement more features of nextjs. Thanks a lot

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад +1

      Thanks a lot!🙏 thats a great idea, thanks!

    • @uetianafridi
      @uetianafridi Год назад

      @@TuomoKankaanpaa welcome
      and thanks to you to consider it a great idea

  • @johanneslangosch7517
    @johanneslangosch7517 Год назад

    I really appreciate this video! As a beginner I was confused how to use server or client components. Thank you very much got this example, it helps me a lot!

  • @ahmedabbas3981
    @ahmedabbas3981 Год назад

    Getting this error when i am trying to delete item from todo list. any solution for it?
    DELETE localhost:3000/api/todo/delete?id=863a39be-3c96-473d-a800-b458ec5bfabd 404 (Not Found)
    Code:
    async function deleteTodo(id, refresh) {
    await fetch(`/api/todo/delete?id=${id}`, {
    method: "DELETE",
    });
    refresh();
    }

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Looks like it cant find the route (404), make sure u have correct url and correct port!

  • @pbtrading
    @pbtrading Год назад

    Nice video! Love the channel and your teaching style.
    Greetings from Sweden.

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Thank you Philip! Greetings to the neighbour! 🙌

  • @utkarshseth3082
    @utkarshseth3082 Год назад

    When I am trying something like this as my own I am getting lots of error, Whole thing new and with your explanation everything is clear 😀 Thank you for making this video .

  • @junaidalam7371
    @junaidalam7371 Год назад

    Awesome

  • @patite3103
    @patite3103 Год назад

    I don't see the Github link. thank you for adding it.

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Here is the link for the server: github.com/tumetus/json-api

  • @mufa4567
    @mufa4567 Год назад

    Hi! I have issue with cors. After adding mode:"no-cors" I still got error from the console. What can I do?

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Hard to say for sure, one thing to try is add a rewrite rule to nextjs config, that might help!

    • @mufa4567
      @mufa4567 Год назад

      @@TuomoKankaanpaa Thanks for replay. I've done everything like on the video, and now when I've add rewrite rule , application throws "GET localhost:3000/api/todo/update 400 (Bad Request)". In next config I've specified localhost:3001

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      @@mufa4567 Make sure you have the correct port for the server and you can also try to replace "localhost" with "127.0.0.1". In some situations it might be that your environment doesn't understand localhost and you need to define it as an ip. If those don't help, try looking into the request response and server logs if there is something that point you to the right direction

  • @patite3103
    @patite3103 Год назад

    In your video I don't see that you created the folders /api/todo where the file list.js is saved. I cloned the repository code but it doesn't work. the check boxes and delete buttons for example do not appear. Thank you for your help.

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Thanks for the comment! Here are links to the repos, so the "Mock api" is the one that handles "saving" and returning the todos and the "Todo app" repo is the code we do in the video.
      Mock API we use in the video: github.com/tumetus/json-api
      Todo app code: github.com/tumetus/next-js-13-todo-app-example

    • @patite3103
      @patite3103 Год назад

      @@TuomoKankaanpaa Thanks for your answer. What is the difference between the two codes? I cloned the todo app code (second) but I couldn't start the server. since I get an error message. Should I first install something like "npx create-next-app@latest --experimental-app" Why not making a video explaining step-by-step how to clone your code and start + difference between both codes. thank you

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад +1

      You need to clone the both repos and then run yarn install in both repos and then start the dev server in both repos with yarn dev. The todo repo is the actual app that we build in the video and the mock api repo is just a dummy server we make requests to, with the todo app. Hope this helps!

  • @rk5759
    @rk5759 Год назад

    went over my head

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Hopefully you got something out of it tho!

    • @rk5759
      @rk5759 Год назад

      @@TuomoKankaanpaa rewatched it. Got sense out of it.

  • @blakefre
    @blakefre Год назад

    Hey thanks for making this video. You're a great teacher.

  • @raymondmichael4987
    @raymondmichael4987 Год назад

    Watched 10 minutes and I’m quite impressed with your pace, I’ll come to this later, I plan to use nextjs very soon, hopefully you’ll cover jwt authentication next, preferably with refresh token .
    Subed 😊

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад +1

      Thank you very much, that is great to hear! And thanks for the feedback, I'll take that into consideration for sure when planning future videos!

    • @raymondmichael4987
      @raymondmichael4987 Год назад

      @@TuomoKankaanpaa, thanks

  • @maxvhanamane840
    @maxvhanamane840 Год назад

    Great vid. Would love to see more videos on nextjs 13. I like all the things they did with NextJs 13.

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад +1

      Thanks! I already have bunch of videos about next.js 13 on my channel, you can find them from the latest uploads. I’m also planning on making more tho!

  • @devonedmonds9223
    @devonedmonds9223 Год назад

    Honestly a perfect intro brother. Covered all the fundamentals for me. Subbed 🙌🏻

  • @quickflutterfixes4782
    @quickflutterfixes4782 Год назад

    Hey we really love your way off teaching can you do for us a full next 13 course ?

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Год назад

      Thanks a lot! I have actually been contemplating about making a course but not sure yet. If you want to learn more about next.js 13, I created a playlist which has all my next.js 13 videos so that's a good place to start :) the playlist is here: ruclips.net/p/PLxCkFZQohykk8ejbV94XbigHSONNq4m3C

  • @DragonNova
    @DragonNova Год назад

    Very helpful, thanks :)

  • @zulkifsaltik
    @zulkifsaltik Год назад

    Vere clear! Weiter so, 👏👏👏💯