Skip to content

Commit

Permalink
Update prop types for comment for improved structure
Browse files Browse the repository at this point in the history
Enhanced the comment prop validation with PropTypes.shape instead of PropTypes.object for improved, clearer structure. Provides a more explicit structure for the expected shape of the object, improving code readability and maintainability.
  • Loading branch information
Aaron-Chacko authored Oct 18, 2024
1 parent 5e1d8c2 commit b8ce073
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/javascript/components/Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,16 @@ Comment.propTypes = {
PropTypes.array,
PropTypes.element
]),
comment: PropTypes.object.isRequired,
comment: PropTypes.shape({
authorId: PropTypes.number.isRequired,
authorPicUrl: PropTypes.string,
authorPicFilename: PropTypes.string,
authorUsername: PropTypes.string.isRequired,
commentId: PropTypes.number.isRequired,
commentName: PropTypes.string,
htmlCommentText: PropTypes.string.isRequired,
timeCreatedString: PropTypes.string.isRequired
}).isRequired,
deleteButton: PropTypes.element.isRequired,
editCommentForm: PropTypes.element.isRequired,
isEditFormVisible: PropTypes.bool.isRequired,
Expand Down

0 comments on commit b8ce073

Please sign in to comment.