Also just a FYI I have definitely seen some frontend developer interviews where u are asked to make a fetch request and render some data in the frontend and make a little cool site.
I think I may have solved this.. but not entirely sure, let me know what you think, So i believe I was getting an error and had to provide the array [] syntax as a param to useState() because my PC is processing the return code block faster than the API can respond, so it gave me an undefined error until I added that []. What is your opinion. I am still learning but this is how i can imagine in the background it fixed
Add dependency array and if you are getting undefined reading map error, try something like this {word && word.map(()) => so on... sometimes if there's no data in the api, you will get this map error. Trying adding word && word.map. It will work.
⚛ FREE React Course (download & bonus content) - calcur.tech/free-react-course
React UA-cam Playlist - calcur.tech/react-playlist
Code - github.com/CalebCurry/react
This series is exceptional. You have a great way of explaining and illustrating complex concepts. And I appreciate your sense of humor.
I wrote my first React Component using useState, useEffect and Fetch. Thank you Caleb.
And you can also create .env file in the frontend and just get the information of the kry from there and that way no one can get their hands on that
there is nothing secret on the frontend, browser has all the code, the object where you load the key from the .env file
Also just a FYI I have definitely seen some frontend developer interviews where u are asked to make a fetch request and render some data in the frontend and make a little cool site.
You’re back
lol 'it's going to be ugly but you're already seeing me'
Please make a video on how to build complex api with the mern stack
I have people using async on fecth, do you a have a video about fecth that explain differents way of using them
Yay
👍
👩👩👧👧👨👩👧👧👨👩👧👨👩👧👨👨👧👧
i am first
return (
Here is an example of a random definition :
{word.map((meaning) => {
return {meaning.defintions[0].definition}
})}
); does not work for me, I get an error of undefined reading, It;s because the API call data hasnt been set to word yet? how is yours working?
I fixed it by adding an empty arry to the useState method call like so =useState = ([]); and the error fixed. Why is this not an issue for you?
I think I may have solved this.. but not entirely sure, let me know what you think, So i believe I was getting an error and had to provide the array [] syntax as a param to useState() because my PC is processing the return code block faster than the API can respond, so it gave me an undefined error until I added that []. What is your opinion. I am still learning but this is how i can imagine in the background it fixed
Add dependency array and if you are getting undefined reading map error, try something like this
{word && word.map(()) => so on... sometimes if there's no data in the api, you will get this map error. Trying adding word && word.map. It will work.