i’ve been debugging for a while now watched every part of the video. Reset and recoded the project multiple times but always the comments arent loading the request gets send and a response is returned but sadly no output. You guys got any ideas? Thanks in advance
Comment.js
import React from 'react';
export default function Comment({ comment }) {
const { id, text } = comment
return (
<li key={id} className='comment-container'>
<span>{text}</span>
</li>
);
}
CommentForm.js
import React, { useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import {
createCommentIsPending,
} from '../features/comments/commentsSlice';
export default function CommentForm({ articleId }) {
const dispatch = useDispatch();
const [comment, setComment] = useState('');
// Declare isCreatePending here.
This file has been truncated. show original
CommentList.js
import React from 'react';
import Comment from './Comment';
export default function CommentList({ comments }) {
if (comments) {
return (
<ul className='comments-list'>
{comments.map((comment) => (
<Comment key={comment.id} comment={comment} /> // Ensure to include key prop
))}
This file has been truncated. show original
There are more than three files. show original
If anyone is still looking for a solution. Here:
CommentForm.js
import React, { useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import {
createCommentIsPending,
} from '../features/comments/commentsSlice';
export default function CommentForm({ articleId }) {
const dispatch = useDispatch();
const [comment, setComment] = useState('');
// Declare isCreatePending here.
This file has been truncated. show original
CommentList.js
import React from 'react';
import Comment from './Comment';
export default function CommentList({ comments }) {
if (comments) {
return (
<ul className='comments-list'>
{comments.map((comment) => (
<Comment key={comment.id} comment={comment} /> // Ensure to include key prop
))}
This file has been truncated. show original
Comments.js
//comments.js 9
import React, { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import {
loadCommentsForArticleId,
selectComments,
isLoadingComments,
This file has been truncated. show original
There are more than three files. show original
1 Like
Thank you, I am having the same issue as well!
Did you understand what was the issue?
P.s. thank you for the links, I will look through them!
I hope you got it working.
I think there was some error about how the data from the request has been saved,
Have a great day/night.
Greetings Kim
1 Like