Skip to content

BHAV0207/Comment_Section

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Comment Section

This project implements a dynamic comment section using React. It allows users to add, edit, delete, and reply to comments, with persistent storage using localStorage.

Features

  • Add new comments
  • Edit existing comments
  • Delete comments with confirmation
  • Reply to comments (nested comments)
  • Sort comments by newest, oldest, or most replies
  • Persistent storage using localStorage
  • Responsive design using Tailwind CSS

Installation

  1. Clone the repository: git clone https://github.com/your-username/react-comment-section.git

  2. Navigate to the project directory: cd react-comment-section

  3. Install the dependencies: npm install

  4. Start the development server: npm start

Usage

  • To add a new comment, fill in the name and comment fields at the top of the page and click "Add Comment".
  • To edit a comment, click the "Edit" button next to the comment, make your changes, and click "Update Comment".
  • To delete a comment, click the "Delete" button and confirm your action in the popup.
  • To reply to a comment, click the "Reply" button, fill in your name and reply, then click "Submit Reply".
  • Use the sort dropdown to change the order of comments.

Dependencies

  • React
  • Tailwind CSS

Structure

The main component is CommentSection, which handles all the logic for managing comments. It uses several React hooks:

  • useState for managing component state
  • useEffect for handling side effects like loading and saving comments to localStorage

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open source and available under the MIT License.