Skip to content

Had a problem in chapter 3.  #14

Open
@jdavidmcgee

Description

@jdavidmcgee

Dave,

Love your stuff! You are the best. Thank you all all you're doing to help us new and inspiring developers.

In chapter three (I believe) I ran into a problem where the code added the 100 posts twice...creating a 200 post rendering and some weird behaviors for clicking on the emojis. When I added a new post it would place the new post right after the first post...not before.

I don't know the reason for this entirely...since I'm still new to the react and redux world but I hung with it for a while and eventually, in the postsSlice.js file (somewhere around line 88), I changed the code from:

'state.posts = state.posts.concat(loadedPosts);'

to

'state.posts = loadedPosts;'

With this change the rendering of all the posts twice stopped. With this change I also noticed that when I created a new post it was placed on the top. So I'm wondering if maybe between when you released the video tutorials and now (a couple of years later) maybe react, reduce, thunk or axios or something else has updated that created this twice rendering and making a 200 entry list of posts problem.

I wanted you to know what I encountered and how it was maybe fixed(???? time will tell as I do more work).

Wishing you all the best.

my email is [email protected] if you want to share any further insights...I am a new developer in training and your stuff is really really good!

All the best,

David

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions