What I love the most about Hamed's videos is that he covers literally every detail no matter how small it seems. He apologized for self-promotion but there was no need to apologize because it just shows how much of content this man has already created for us on Nextjs and was just pointing us in the right direction in case we needed more info on the topics he was discussing.
@hamedbahram Жыл бұрын
Thanks Kyle! I appreciate that.
@Shawn-Mosher Жыл бұрын
Very cool!!! Gets better and better. Good job showing us these new updates
@hamedbahram Жыл бұрын
Anytime Shawn!
@rebazjabar7660 Жыл бұрын
so excite to see you're working with up-to-date topic. we appreciate you
@hamedbahram Жыл бұрын
Thanks Rebaz. Glad you found it helpful.
@BuiltWithLLMs Жыл бұрын
Only person doing MongoDB + Next 13 right now, thanks!
@BuiltWithLLMs Жыл бұрын
State management in next 13 would also be interesting
@hamedbahram Жыл бұрын
That's right David, you won't see mongo that often these days.
@hamedbahram Жыл бұрын
Agreed. That's an interesting topic to cover next. Thanks for the feedback.
@arman4887 Жыл бұрын
I feel blessed to have found this channel. Great video on up-to-date Nextjs topics with MongoDB
@hamedbahram Жыл бұрын
Happy to have you here Arman. I'm glad you found the content helpful.
@Billiam112 Жыл бұрын
Great stuff, looking forward watching the whole thing :)
@hamedbahram Жыл бұрын
Thanks for tuning in Bill!
@abibinyun Жыл бұрын
thx for detail information, absolutely amazing, i like how you description detail feature from next js,
@hamedbahram Жыл бұрын
Your welcome! Thanks for tuning in :)
@noahginsburg6140 Жыл бұрын
Awesome video. Love that you’re taking the time to keep up with the current fire hose of nextjs updates. Here’s my question, in your lib folder where you define the mongodb methods couldn’t you have a method that makes the db connection and makes your db mutation similar to how you directly go to mongo to GET the todos? What are the direct benefits of the actions? Also, would you typically turn those GET methods into an api? I’ve always just made apis for data access without considering just making a method and going right to the db. Thanks for the great content!
@hamedbahram Жыл бұрын
Thanks Noah for leaving your feedback. Making APIs to access your database was the way. But with the new server actions, you don't really need that extra layer, you can define functions that run on the server and just call them from the client.
@LifeWithRilla Жыл бұрын
@@hamedbahram So if I'm understanding correctly the server actions just remove the API layer?
@hamedbahram Жыл бұрын
@@LifeWithRilla I think it's fair to say that.
@Billiam112 Жыл бұрын
If I may suggest for a future video; I would be super interested in a nextjs + strapi video.👌
@hamedbahram Жыл бұрын
You got it!
@mobpsycho6600 Жыл бұрын
It was worth to watch this video
@hamedbahram Жыл бұрын
Thanks for tuning in!
@eloualielouali4949 Жыл бұрын
top notch video, i was wandering if u want to add a delete button next to every todo how would u handel the action
@hamedbahram Жыл бұрын
That'll be the same, you can have a button with 'fromAction' prop on it point to a 'deleteTodo' action, or a form the same way with an 'action' prop
@eloualielouali4949 Жыл бұрын
@@hamedbahram thank u so much for ur time
@hamedbahram Жыл бұрын
@@eloualielouali4949 my pleasure
@lulungsatrioprayuda9931 Жыл бұрын
I'm so excited to follow you tutorial sir, did you have any tutorial that create simple auth with jwt token? thank you
@hamedbahram Жыл бұрын
Thanks Lulung. I use `next-auth` for authentication. It's pretty simple and straight forward. You can watch it here: kzbin.info/www/bejne/e5mWdqOtprlnma8
@hfzkq Жыл бұрын
Awesome ❤Go ahead
@hamedbahram Жыл бұрын
Thanks! Let's go!
@alirezadnia Жыл бұрын
Perfect. Thank you Hamed
@hamedbahram Жыл бұрын
My pleasure buddy! Thanks for tuning in.
@ofermalbin Жыл бұрын
Thanks for the video! Could you give an example of a field of type file? How do I extract the name of the file and its contents in action?
@hamedbahram Жыл бұрын
Good question Ofer. I'll definitely cover that in a future video. Thanks for tuning in.
@juanferrer5885 Жыл бұрын
Awesome video!! Could you talk about internationalization in nextjs AppRouter?
@hamedbahram Жыл бұрын
Thanks Juan. Sure, that'll be an interesting topic. Will keep that in mind.
@GregPeters1 Жыл бұрын
Thanks for the heads up!
@hamedbahram Жыл бұрын
Anytime! Thanks for tuning in Greg.
@AnthonySmith-tw2ll Жыл бұрын
Great content, thank you! I can't seem to get server actions to work on pages generated with generateStaticParams... any idea why? I'm getting 405 method not allowed but the same component submits data fine on other pages.
@hamedbahram Жыл бұрын
You're welcome Anthony, thanks for tuning in. I'll test that out. In the mean time, can you do the following and let me know, I'm assuming this is a server-rendered page, can you comment the `generateStaticParams` function out and then try on that same page? Also, do you have a `route.js` file defined at that segment?
@AnthonySmith-tw2ll Жыл бұрын
@@hamedbahram Thanks for the quick reply, Hamed. If I comment out the function then it does work - so it does appear to be a conflict there but not sure how to fix currently. The structure is reviews(folder) -> [slug](folder) -> page.tsx (file containing generateStaticParams)
@AnthonySmith-tw2ll Жыл бұрын
@@hamedbahram I've used notfound from next/navigation instead of fetching the static paths up front. I think that fetching the static paths means that you can't use a server action on that page. I get the same result and am able to use server actions now so I think this is the method to use going forward.
@hamedbahram Жыл бұрын
I see. I'd have to test this out myself.
@oluwafemifaleye6845 Жыл бұрын
Thank you for this interesting video. Please, how can I handle file upload using the server component?
@hamedbahram Жыл бұрын
Thanks Oluwafemi! I'll be covering that in a future video soon.
@rajenderkatkuri7642 Жыл бұрын
What font do you use in VS Code?
@hamedbahram Жыл бұрын
Operator mono!
@alvinacosta2312 Жыл бұрын
how to redirect to a different page after a todo is created sir? previously we had to use useRouter. how to do it in a server component after the server actions is done. thanks!
@hamedbahram Жыл бұрын
You can call `redirect` from `next/navigation` in your server action function.
@ARUNRAWAT-rh5ks Жыл бұрын
could a make a video on how cna we update the session info after user logged in ?
@hamedbahram Жыл бұрын
Thanks for the feedback. I'll have that in mind for a future video. In the mean time you can read more about the new `update` function from the next-auth package: next-auth.js.org/getting-started/client#updating-the-session
@ИванАрабаджийски Жыл бұрын
How are you supposed to handle loading state and errors using this server actions? What if I double click the button while the first call is still being awaited?
@hamedbahram Жыл бұрын
Good question! you can use the `useTransition` hook or the `experimental_useFormStatus` from react to get a pending state while executing the server action. For error handling you can watch this video where I use zod to validate the inputs => kzbin.info/www/bejne/qZWud3ila55qbrc
@soundnimation Жыл бұрын
Cool video)) I am looking for a method to save the state of the page after reloading, can you recommend something, please? I want to avoid storage or cookies, what I am looking for is something that was in a react-router page state. Thank you in advance. For example, menu is open and after reloading it is closed, or the pagination state or filter state
@hamedbahram Жыл бұрын
Different ways you can do it, for example you can use the URL for some state, things like filter and pagination can be persisted in the URL, for UI state you can use the React context.
@DioArsya Жыл бұрын
is using actions function like that doesn’t expose the important credentials on the server side?
@hamedbahram Жыл бұрын
That's a good question! server actions are only running on the server, but it's important to understand how to use them correctly. Also keep in mind that this is still in alpha release and not production ready in any shape or form, so we'll most likely see changes in the future.
@eliuddyn Жыл бұрын
Great 🔥🔥
@hamedbahram Жыл бұрын
Thanks for tuning in.
@AbdallahMoubarak Жыл бұрын
Hello Hamed, How can we add mongoose to this and use the models?
@hamedbahram Жыл бұрын
Hello Abdallah, it would be very similar to what I'm doing in this video, you can define your models and expose your database access objects (functions) like I did in the `lib/mongo/todos.js` file. However, I don't recommend using mongoose, if you're looking to use an ORM, use Prisma, which gives you type-safety as well. I have a video coming out tomorrow, where I demonstrate this.
@AbdallahMoubarak Жыл бұрын
@@hamedbahram thank you bro..
@hamedbahram Жыл бұрын
@@AbdallahMoubarak My pleasure.
@damiantriebl1747 Жыл бұрын
and for use Redux with client and server component (in the same store) is posible?
@hamedbahram Жыл бұрын
I'm not sure how you would fit Redux into this architecture. I would use native Javascript patterns like modules to share data and logic between server components and React context for client components.
@KendaBeatMaker Жыл бұрын
@@hamedbahram hey guys did a little experiment and was able to get recoil working by creating a component that takes children and wrap them with recoilroot. Then wrap the root layout with this created component (recoilroot)
@hamedbahram Жыл бұрын
@Ken Taylor Cool! Share your solution if you don't mind.
@Fantasia1013 Жыл бұрын
what means "mutate data" ?
@hamedbahram Жыл бұрын
It means Changing or updating your data
@Fantasia1013 Жыл бұрын
@@hamedbahram ty so much
@hamedbahram Жыл бұрын
@@Fantasia1013 Anytime!
@techcoevolve Жыл бұрын
Cool shirt buddy :)
@hamedbahram Жыл бұрын
Thanks 🙏🏽
@moinkhanpathan541 Жыл бұрын
can we update data using server action?
@hamedbahram Жыл бұрын
Absolutely! server mutation is exactly updating data using server actions.
@0xtz_ Жыл бұрын
Woooow
@hamedbahram Жыл бұрын
My pleasure 😀
@leopolddelassence5224 Жыл бұрын
very cool, but video is slightly too long
@hamedbahram Жыл бұрын
Thanks for your feedback. I'll try to make future videos more concise.
@misterkilluminati6949 Жыл бұрын
Thanks for the amazing and straight forward contents :) Quick questions though. Do we have to make a route segment, which has a form that has a server action on it, dynamic(AKA SSR) ?
@hamedbahram Жыл бұрын
Thanks! glad you find the content useful. Good question! no you don't have to make it dynamic, in fact unless you're using a dynamic function like `headers`, `cookies`, etc. it will be static by default.
@misterkilluminati6949 Жыл бұрын
@@hamedbahram I was actually remaking the project you did on your video about how SSR, SSG and ISR are different from each other, and changing your Form component to use server actions instead of onSubmit. The problem is, if I use a server action on the form component, all the three SSG, SSR and ISR pages which use that Form component, will turn SSR when I build the project. I was hoping you could give a hint of what's going on. There's nothing on the docs about this
@hamedbahram Жыл бұрын
Hmm 🤔, Interesting! cool idea to combine server actions with the whole dynamic vs static rendering and see the result. I'd have to test that out
@misterkilluminati6949 Жыл бұрын
@@hamedbahram I would love to see a video on it from you in the future :) Thankss