RolandGuijt / ps-react-fundamentals

113 stars 142 forks source link

Code for api missing #6

Closed edchelstephens closed 1 year ago

edchelstephens commented 1 year ago

Hi @RolandGuijt,

I'm following thru your course and I'm at "Effects and Re-rendering" section:

I am coding along and I have a problem.

I'm trying to learn the useEffect with the api call:

useEffect(()=>{ const fetchHouses = async () => { const response = await fetch("/api/houses"); const houses = await response.json(); setHouses(houses); } fetchHouses(); })

But I don't have the see the files for the pages/api/houses?

Can you please add them? If it is already there, can you point me where it is?

This is my first time with Next.js so I don't know what to do.

I'm puzzled that I can't find the api/houses/code for the "/api/houses" request.

I want to continue following along and I do it my coding along, step by step.

image

RolandGuijt commented 1 year ago

Hi,

Please take a look at the different branches available in the repo.

On Thu, 28 Sept 2023, 16:31 Edchel Stephen Nini, @.***> wrote:

Hi @RolandGuijt https://github.com/RolandGuijt,

I'm following thru your course and I'm at "Effects and Re-rendering" section:

I am coding along and I have a problem.

I'm trying to learn the useEffect with the api call:

useEffect(()=>{ const fetchHouses = async () => { const response = await fetch("/api/houses"); const houses = await response.json(); setHouses(houses); } fetchHouses(); })

But I don't have the see the files for the pages/api/houses?

Can you please add them? If it is already there, can you point me where it is?

This is my first time with Next.js so I don't know what to do.

I'm puzzled that I can't find the api/houses/code for the "/api/houses" request.

I want to continue following along and I do it my coding along, step by step.

[image: image] https://user-images.githubusercontent.com/49672830/271318203-d5d868da-70c0-4345-aba9-0a3023b138e9.png

— Reply to this email directly, view it on GitHub https://github.com/RolandGuijt/ps-react-fundamentals/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADB3GJRQJR7ECZRMQNPEMKLX4WC5RANCNFSM6AAAAAA5LCHF3Y . You are receiving this because you were mentioned.Message ID: @.***>

edchelstephens commented 1 year ago

Thanks @RolandGuijt , got it! :)

It was in the RenderingSideEffects branch.