feat: add Sum component#4291
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation has two critical issues that violate explicit requirements: 1. Template literals violation [CHECKLIST #2]: The Sum component uses {a}, {b}, and {a + b} as separate JSX expressions instead of template literals. Change the paragraph content to use a single template literal: `<p>Sum of ${a} and ${b} is ${a + b}</p>`. 2. Props passing requirement violations: Three instances in App.jsx incorrectly pass explicit 0 values: - <Sum a={10} b={0} /> should be <Sum a={10} /> (requirement: "just a = 10") - <Sum a={0} b={5} /> should be <Sum b={5} /> (requirement: "just b = 5") - <Sum a={0} b={0} /> should be <Sum /> (requirement: "no params at all"). The default parameter values in Sum should be tested by omitting those props, not by explicitly passing 0. Passing 0 means the prop is being passed (with value 0), which defeats the purpose of testing the default behavior. These fixes will align your code with both the task requirements and the checklist items. The component logic itself is correct—just needs these adjustments to match the specification exactly.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| import { Sum } from './components/Sum/Sum'; | ||
|
|
There was a problem hiding this comment.
This violates checklist item #2: Use string interpolation inside tag content. Use template literals instead of separate expressions. Change to: {Sum of ${a} and ${b} is ${a + b}}
| {/* And remove commented lines :) */} | ||
| <Sum a={2} b={3} /> | ||
| <Sum a={-5} b={5} /> | ||
| <Sum a={10} b={0} /> |
There was a problem hiding this comment.
The requirement specifies 'just a = 10' with no b param. Passing b={0} explicitly means b is passed, not defaulted. Change to:
| <Sum a={2} b={3} /> | ||
| <Sum a={-5} b={5} /> | ||
| <Sum a={10} b={0} /> | ||
| <Sum a={0} b={5} /> |
There was a problem hiding this comment.
The requirement specifies 'just b = 5' with no a param. Passing a={0} explicitly means a is passed, not defaulted. Change to:
| <Sum a={-5} b={5} /> | ||
| <Sum a={10} b={0} /> | ||
| <Sum a={0} b={5} /> | ||
| <Sum a={0} b={0} /> |
There was a problem hiding this comment.
The requirement specifies 'no params at all'. Passing a={0} b={0} means params are passed. Change to:
| export const Sum = ({ a = 0, b = 0 }) => ( | ||
| <p> | ||
| Sum of {a} and {b} is {a + b} |
There was a problem hiding this comment.
This violates checklist item #2: Use string interpolation inside tag content. The paragraph should use a template literal like {Sum of ${a} and ${b} is ${a + b}} instead of separate JSX expressions.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation fully meets all requirements. The Sum component correctly uses a named export, accepts a and b props with default values of 0, and renders the text using template literals as specified. The App component properly includes all five required Sum instances, testing default parameters by omitting props where appropriate rather than passing explicit 0 values. The CI workflow failures are unrelated to your code—they're caused by GitHub Actions infrastructure issues when downloading action archives from codeload.github.com. This is a transient infrastructure problem that doesn't reflect any issues with your implementation. Once the infrastructure issue is resolved, your code should pass all checks without any modifications.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
DEMO LINK