PrimeAcademy / biscayne-syllabus

1 stars 4 forks source link

Help with conceptual data structures for rendering my like count on a book review #6

Closed janetscanlon closed 4 months ago

janetscanlon commented 4 months ago

Description

Your Real Name

Janet Scanlon

What do you want to happen? I want to be able to render the like count for each review post What is actually happening? My likeReducer is being updated for each post (which is what I want) but it's only rendering the data stored in the latest update. I'd ideally like to be able to render the reducer data for each iteration of posts -- Currently I believe I have my code set up so that it runs my "FETCH_REVIEW_LIKES" every time a post is rendered. UseEffect (Line 22 in the ReviewPost.jsx component.)

I've included pictures of my sql query: SELECT * FROM "review_likes" WHERE "review_id" = $1;

using req.params to send over the review id.

Saving the response.data in an array in the reducer.

no errors

Screenshots / Code Snippets

Screenshot 2024-05-26 at 4 04 43 PM Screenshot 2024-05-26 at 4 05 31 PM Screenshot 2024-05-26 at 4 12 22 PM Screenshot 2024-05-26 at 4 12 40 PM Screenshot 2024-05-26 at 4 12 54 PM Screenshot 2024-05-26 at 4 13 05 PM Screenshot 2024-05-26 at 4 13 48 PM Screenshot 2024-05-26 at 4 14 18 PM

What did you try? Who did you ask?

Talked over conceptual concepts with kristin and alex -- Thought about restructuring my db Table but I feel like I should be able to make this work?? I'm just missing some pieces.

no debugging ... just help with concepts on how to execute

What branch is your code on? Did you git push?

feature/likes

When was the last time you took a break?

20 minutes ago

janetscanlon commented 4 months ago

branch is pushed up to github!

matthew-black commented 4 months ago

We're going to modify the GET /reviews route to include a like_count property on each review object.