project_graphql_blog icon indicating copy to clipboard operation
project_graphql_blog copied to clipboard

Comment doesn't display with correct slug

Open tuankietcoderr opened this issue 2 years ago • 1 comments

In components/Comments.jsx line 14: If we don't add slug to [], the comments won't display until we refresh the page. Solution: add slug to [] like this: from

 useEffect(() => {
    getComments(slug).then((result) => {
      setComments(result);
    });
  }, []);

to

 useEffect(() => {
    getComments(slug).then((result) => {
      setComments(result);
    });
  }, [slug]);

Hope this will behelpful!

tuankietcoderr avatar Feb 08 '22 05:02 tuankietcoderr

Thank You!

mateen993 avatar Jul 30 '22 10:07 mateen993