After watching just first minute of your video, I am your subscriber. Sir!
@ApurvKhare4 жыл бұрын
Watched all 10 videos in a go 🔥
@ranjeet58063 жыл бұрын
koi award do bhai isko
@parsajafari513 жыл бұрын
shaun I have learned a lot from you it started from basic html css js unitl now that I am a react developer and want to learn Next to build fantastic projects
@kapilyadav96642 жыл бұрын
Brother thank you so much for creating this video. Subha se pareshan ho rha that UI pe data show karane ke wajah se. But aapka video dekh kr ek baar me kaam ho gya.. Thanks for creating this useful video.
@maskman48214 жыл бұрын
getStaticProps function in Nextjs works same as asyncData hook in Nuxtjs, they both works in page component only, do the same thing (fetching data on server side). we can learn Nuxtjs at the same time and compare the differences !!!
@hafsahussein20164 жыл бұрын
hello the net ninja the best youtuber ever for my web development learning journey, I would like javascript design patterns with real life projects, the most of the courses explain them without giving real life projects so please try that
@simply_the_dev75883 жыл бұрын
export async function getStaticProps() { const exploreData = await fetch("some link").then( (res) => res.json() ); const cardData = await fetch("some link").then((res) => res.json() ); return { props: { exploreData, cardData, }, }; Above is some code from another project showing another way. Maybe this helps others.
@anggurmerah30252 жыл бұрын
thank you sir, my error program map is running.
@frogGames2 жыл бұрын
thanks this worked
@dmitriystoyanov9333 жыл бұрын
Thank you, bro! I solved my task with help of this tutorial!
@mjylove26 ай бұрын
finally i understood this concept thank you
@NetNinja6 ай бұрын
Great to hear!
@luismuzquiz3 жыл бұрын
What if the data comes from a local json file on a folder called data?
@jamesaldridge11282 жыл бұрын
did you figure this out?
@luismuzquiz2 жыл бұрын
@@jamesaldridge1128 Yeah, long time ago
@sauvikgoel591 Жыл бұрын
@@luismuzquiz then let us know that too 🙌
@MerthanMerter3 жыл бұрын
6:17 how did you fix this error, it does persist on mine?
@Awesometechgamer2 жыл бұрын
im having the same Error : (
@penocrat Жыл бұрын
Thanks so much for this lesson, Shaun. You've really been an amazing guide in my programming journey. But I do have a question though. Coming from a cybersecurity background, I like to think of security best practices... I'm somehow concerned about the amount of data we're fetching for each user from the API only to use a single "name" data. I think tools such as "burp suite" can be used to intercept these API requests and all these data would be out there in the open. Even those that aren't intended to be disclosed to the public. How then can we prevent this type of vulnerability? I'm thinking there'd be a way to filter the data returned to us and not the entire data.
@jonkarrer3 жыл бұрын
You are changing lives out here.
@KimCarlos12 Жыл бұрын
You teach from a beginner perspective and keep it simple. You are my best youtube-teacher. If someone like @WebDevSimplified built this tutorial, he would have probably used a database connection and i bet thats where any beginner watching would click out of the video and look for a simpler one. No offense @WebDevSimplified
@Awesometechgamer2 жыл бұрын
im getting the error called ( property 'map' of undefined ) please Help : ( I followed everything as it is
@prakharmathur6194 жыл бұрын
please make more tutorials, I am using next in my internship and it is helping a lot
Hi. Naïve question here: if getStaticProps runs at build time, how are we able to access the data it in development?
@Azro-g3w Жыл бұрын
This is SO cool ❤😊
@esirkings41913 жыл бұрын
Nice tutorial. How do you handle errors e.g in case that API is unavailable?
@subhasishnath30782 жыл бұрын
Next Doc example: nextjs.org/docs/basic-features/data-fetching/get-static-props#using-getstaticprops-to-fetch-data-from-a-cms
@learnsimple45924 жыл бұрын
Simple and easy to understand :) will you be covering getServerSideProps and getStatic Paths in this course ?
@NetNinja4 жыл бұрын
Yeah - that's coming over the next couple of videos :)
@apezcodes7043 жыл бұрын
very simple and details God bless. i have search the whole internet for this simple details. please can you make a video on how to build a complete website with nextjs fetching static and dynamic data
@suzanne_atkinson Жыл бұрын
Thank you for the great teaching. How is this function different from the useFetch function that you build in your Udemy course? Is this preferred for next, or is this just fora. single page at a time?
@webarrays2 жыл бұрын
Server Error TypeError: Cannot read properties of undefined (reading 'map') its showing an error and not solving
@muhammadfirmanakbar96963 жыл бұрын
awesome tutorial thanks
@coffeefps3 жыл бұрын
For the getStaticProps, do we have something like a prop we can get to check if data is fetching? So we can show stuff like a loader/skeleton in the UI to tell the user we are fetching data.
@brucelee77823 жыл бұрын
4:50 I wonder how does getStaticProps automatically puts the props it returned into the Ninjas function lol. I read the documentation and it just says "populated", whatever that means
@justinlu57303 жыл бұрын
thats because getStaticProps executes before the component is render and for that reason pass the props to the function somehow.
@brucelee77823 жыл бұрын
@@justinlu5730 thats not answering the question bro haha
@alejandrocano883 жыл бұрын
I believe it needs to build in order to get that data? not sure..
@alexlytle0893 жыл бұрын
New subscriber so much better than brad traversy
@kresnofatihimani84023 жыл бұрын
what about listeners like firebase onSnapshot functions? do we put it in the getstaticprops as well? thx 😁
@andante49554 жыл бұрын
I recently finished your Udemy JavaScript course Shaun, and it was excellent, thank you. Should I now learn React & Next? Or Vue & Nuxt? Its so confusing? I honestly don't know where to go now?
@NetNinja4 жыл бұрын
Hey, well done & thanks :). I would advise learning Vue or React first - these are front-end JS frameworks/libraries for making websites. Once you've done that, dive into Next.js (if you chose React) or Nuxt.js (if you chose to learn Vue). Both of these allow React and Vue to run on the server (SSR).
@Clones13 жыл бұрын
Great video I only have one question how do I put in basic Auth agains a api endpoint in next.js keep it up great content
@rachaelmathew53283 жыл бұрын
Hi, I got the "TypeError: Cannot read property 'map' of undefined" but when I reloaded my page, I still had the error.
@kaylaginger20102 жыл бұрын
same
@lan.__.e Жыл бұрын
Did you use the same API as in the video? It should be working I worked with another API which had only one element and had the same problem (makes sense it won't map, cause it's only one object) You should be using API with an array of objects
@ktoscos45462 жыл бұрын
getStaticProps need be in component which is in pages folder , I tried do it in component from another my own folder and there doesnt work
@gavquinny3 жыл бұрын
Amazing content - ty! :)
@rahulnarayanan7784 жыл бұрын
Awesome tuts!
@NetNinja4 жыл бұрын
Thank you :)
@seanpaulson90982 жыл бұрын
why are you exporting the getStaticProps function when its in the same file?
@filip231282 жыл бұрын
Thanks!
@BBOXPLANET3 жыл бұрын
Why did you use props? Is not UseContext better?
@fariedomar4013 жыл бұрын
i got this error : TypeError: Cannot read property 'map' of undefined
@bishnudas35623 жыл бұрын
can you explain why we are exporting getStaticProps function?
@ismetglumcevic70614 жыл бұрын
Hi, can we use context to store fetched data like in react? Does it make sense in server rendering?
@mohamedyoussef88353 жыл бұрын
Super Awesome Tutorial - thank you ++++++++++++++++++++
@marcinkalmar99642 жыл бұрын
really really thanks :)
@HrissW4 жыл бұрын
how do you learn this skill so fast?
@NetNinja4 жыл бұрын
It's my full-time job to learn & teach, so it gets easier over time! :)
@HrissW4 жыл бұрын
Thanks:) can make a vid on how I learned things if possible, it would be helpful for us
@craigroberts44452 жыл бұрын
.map is not a function - supposedly the .map function only works for arrays ?
@Mufaqar2 жыл бұрын
How can we use this Ninja Component in other components/pages?
@arthuroyugi20452 жыл бұрын
hi, what do you do i your map function doesnt work after the refresh?
@anggurmerah30252 жыл бұрын
sorry sir, i got eror in list ninja, when refreshed it doesn't turn into a data list, how?
@remofurrer10112 жыл бұрын
How can you fetch the Data from a local file? I can not figure this out. With dynamic routes.
@ashishdhakal4087Ай бұрын
MY 404 page is not automatically reconized , by the app i tried looking up the default 404 templete and edit it, but couldn't find it. Same with page title and Meta data looks like it's automatically fetching from default location instead of reading my code. Possibly because of the newer version , also this version doesn't have index.html and it's directly page.js and layout.js in src folder which makes it a bit harder to follow up with the tutriorial , Need the Suggensitons please
@ogibinedi2 жыл бұрын
what the difference between getServerSideProps, i am getting an error product.map() is not a function
@mrFighter9244 жыл бұрын
Why not axios? Just asking? And why not getServerSideProps? What's the difference?
@amongdoomers94644 жыл бұрын
what if I ask you "why not fetch"?, the reason is simple . This is a next js course and not everyone uses axios so maybe he didn't want to confuse us
@FilipeFreire4 жыл бұрын
getServerSideProps gets executed at every request, while getStaticProps only gets called at build time. When you have data you expect to change every now and then, use the first. When you expect data to stay "static", then getStaticProps is your friend :) also, fetch is built into javascript, while axios is an external package you'd need to install, which, for the purposes of this tutorial, would be an overkill (at least in my opinion!).
@mrFighter9244 жыл бұрын
@@amongdoomers9464 i came here to learn something, not debating...
@mrFighter9244 жыл бұрын
@@FilipeFreire thank you for your response, time and patience, this helped me a lot...
@amongdoomers94644 жыл бұрын
@@mrFighter924 bruh, I literally tried to make you understand my point🤥
@sauvikgoel591 Жыл бұрын
How to replicate same thing of we want to re fetch data on certain conditions, like we do in useEffect with dependency array... Pls help
@BrianNelsonFilms3 жыл бұрын
how would you use this if the data didnt have id's? For example i'm trying to fetch data from an object called food and within that object fruit and within that citrus { "food": { "fruit": { "citrus": "orange" } } } I want to fetch the word orange
@avatr71093 жыл бұрын
what are the resources where i can Put my data and then fetch in My next js application? Like above ?? or should i make custom JSON file and fetch inn
@athulkrishnadiyil17353 жыл бұрын
how to do in typescript?
@ritikjain39752 жыл бұрын
Why i'm getting ERROR when I use getStaticProps "Failed to load SWC" . It works fine when I use usEffect instead.
@kosmedsuporte2 жыл бұрын
How can i get some params from the client to my getStaticProps ? e.g: Every time the user change some kind of filter on the front end, my getStaticProps function receive the new parameter and change on the fetch function ?
@mistersir31853 жыл бұрын
Can you please explain why are we using export, async and await. I am new to these keywords. I have done research on my part, but I'm still not 100% clear.
@bardsnight3 жыл бұрын
Watch his tutorial series about Asynchronous Javascript. I'm sure you will leave understanding it way better than before. About export, do you mean ES6 Modules Exports, at the end of a functional component?
@theroastingershow1613 жыл бұрын
i'm getting map undefined
@ibrahim.39993 жыл бұрын
Make sure you're using async/await or putting end points properly, I hope you've figured it out now since it's been a month.
@mat553363 жыл бұрын
Would anyone know why NextJs is giving me the error "banner.map is not a function" I'm somewhat knew doing this stuff and I can't seem to find a fix?
@eotikurac2 жыл бұрын
why skip or ignore error handling when fetching data? i know this is a basic tutorial but a project cannot be complete without detailed error handling. this approach just makes beginners think they know what they're doing and that cannot be a good thing.
@carldrogo9492 Жыл бұрын
You should NOT be building Apps with meta-frameworks if you are a begginner. 🤡
@Guest-nb8se Жыл бұрын
some of peoples get error in map method error: we cant map sth that is undifined sth like that if you get this error you cant do anything this erorr is becose of your next js versian you shode delete your project and make a new one but not like this (npx create-next-app filename) if you make like this you get error write this (npx create-next-app@latest filename) when you add @latest you get the last version
@pavankumargvs56934 жыл бұрын
How can I use redux along with getstaticprops?
@mihaimyh4 жыл бұрын
How to handle authenticated API calls in this case?
@seymurmammadov38682 жыл бұрын
I get the error failed to fetch for some reason
@nishantraoguvvada5 ай бұрын
Does this still work? I'm getting this error: "getStaticProps" is not supported in app/." Apparently, there's been an update to the way one can have SSG but there's no documentation of how. Anyone knows a workaround?
@DarylsWorld2 жыл бұрын
How to sort Name based on id?
@nicolasfranco772 жыл бұрын
map function doesnt work after the refresh? Solution: " I was trying to use getStaticProps in a component archive, it need to be used in a page... Thanks everyone." (stackoverflow)
@allmdp3 жыл бұрын
Best bro
@rodrigo-tj1gf Жыл бұрын
javascript and typescript syntax completely destroy me. so much () and {} and arrow functions that i never have any idea how to do anything
@CryptoZombie666 Жыл бұрын
exactly, never faced such issues in other languages.
@kaduzinhoba4 жыл бұрын
I don't what happens... but my map is not working... ' undefined '
@mistersir31853 жыл бұрын
use Waze app if you're driving. Google map can be confusing when you're driving.
@alphaxchanberg53593 жыл бұрын
You can only use getStaticProps on pages (files in the /pages directory), not in regular React components. I suggest you get the posts in your pages/index.js file and pass them as props to the FeaturedPosts component.
@markokafor74324 жыл бұрын
Nice tuts!!! You should implement a check first next time like this. ninja && ninja.map( ...)
@kakashi39662 жыл бұрын
I don't know how component Ninjas can detect a function getStaticProps ???
@VMzaVAS4 жыл бұрын
Best!
@sarahabib933811 ай бұрын
King
@ridl274 жыл бұрын
ez :D ty.
@incognitohacks48504 жыл бұрын
Programming teacher: Lets learn some Next.js Me: You need to go watch the Het Ninjas Videos noob😎 Classmates: ಠ_ಠ
@simply_the_dev75883 жыл бұрын
Just a side not you can do this:: const res = await fetch("").then( res => res.json() ); Works the same and don't need to add another variable.
@juaninfante70002 жыл бұрын
I think he does that to not get beginner confused
@istoric72212 жыл бұрын
Thank you Ninja. getStaticProps
@rinoohhighskilled7236 Жыл бұрын
for new ppl here with a .map() error, use it like this: (make use of props instead of ninjas) const Ninjas = (props) => { return ( All Ninjas {props.ninjas.map((ninja) => ( { ninja.name } ))} ); }