RolandGuijt / ps-react-fundamentals

113 stars 142 forks source link

HouseList component runs twice on first load #4

Open kramer888 opened 1 year ago

kramer888 commented 1 year ago

@RolandGuijt - I'm new to React and I'm working on the RenderingSideEffects branch from your React 18 fundamentals.

I see something I'm a little confused about.

  1. When I ran the code I see HouseList is rendered (=executed) twice and not one time when the page loads. Then the useEffect is also called twice. Shouldn't it ran only once?
RolandGuijt commented 1 year ago

See module 3, Detecting Problems and Debugging at the 2 minute mark.

On Tue, 7 Feb 2023, 17:47 kramer888, @.***> wrote:

@RolandGuijt https://github.com/RolandGuijt - I'm new to React and I'm working on the RenderingSideEffects branch from your React 18 fundamentals.

I see something I'm a little confused about.

  1. When I ran the code I see HouseList is rendered (=executed) twice and not one time when the page loads. Then the useEffect is also called twice. Shouldn't it ran only once?

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