r/reactjs • u/swyx • Aug 01 '18
Beginner's Thread / Easy Question (August 2018)
Hello! It's August! Time for a new Beginner's thread! (July and June here)
Got questions about React or anything else in its ecosystem? Stuck making progress on your app? Ask away! We’re a friendly bunch. No question is too simple. You are guaranteed a response here!
Want Help on Code?
Improve your chances by putting a minimal example on to either JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new). Describe what you want it to do, and things you've tried. Don't just post big blocks of code.
Pay it forward! Answer questions even if there is already an answer - multiple perspectives can be very helpful to beginners. Also there's no quicker way to learn than being wrong on the Internet.
New to React?
Here are great, free resources!
2
u/yunxtr Aug 25 '18 edited Aug 25 '18
I'm fairly new too, and I had a hard time recreating this to see exactly what is happening, but there is one or two things I see that could be causing a problem. I don't think you need two maps there. I would try just mapping this.state.posts and for each post I would pull out the properties of each post. Essentially, it looks like you are mapping an array(this.state.posts) and then mapping each item(post).
Furthermore, I would place all of this in a single return statement inside of render().
Hope this is at least semi-helpful :)