Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
This requires a few adjustments to meet all the task requirements. While the core calculation is correct, there are three key issues to address:
-
Component Usage in
App.jsx: The task requires testing the default props by omitting them. Instead of<Sum a={10} b={0} />, you should use<Sum a={10} />and let the default forbapply. Please do the same for the other two cases as described in the task. -
Export Type: The
Sumcomponent must only have a named export. Please remove theexport default Sum;line fromsrc/components/Sum/Sum.jsx. -
String Formatting: The text rendering violates a checklist requirement [CHECKLIST ITEM #2]. You need to use string interpolation (template literals) like
{Sum of ${a} and ${b} is ${a + b}}inside the<p>tag.
Addressing these points will fully align your solution with the requirements. You're close!
✨ 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
src/App.jsx
Outdated
|
|
||
| <Sum a={2} b={3} /> | ||
| <Sum a={-5} b={5} /> | ||
| <Sum a={10} b={0} /> |
There was a problem hiding this comment.
The task requires rendering the component with 'just a = 10'. Instead of explicitly passing b={0}, you should omit the b prop and allow the Sum component to use its default value.
src/App.jsx
Outdated
| <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.
Following the requirement for 'just b = 5', the a prop should be omitted here to rely on its default value.
src/App.jsx
Outdated
| <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.
For the case with 'no params at all', the component should be rendered without any props, like <Sum />. This will correctly use the default values for both a and b.
src/components/Sum/Sum.jsx
Outdated
| export const Sum = ({ a = 0, b = 0 }) => { | ||
| return ( | ||
| <p> | ||
| Sum of {a} and {b} is {a + b} |
There was a problem hiding this comment.
This violates checklist item #2, which requires using string interpolation (template literals). The content of the <p> tag should be enclosed in curly braces and backticks, like {Sum of ${a} and ${b} is ${a + b}}.
src/components/Sum/Sum.jsx
Outdated
| </p> | ||
| ); | ||
| }; | ||
| export default Sum; |
There was a problem hiding this comment.
The task description explicitly requires using a named export and not a default one. Please remove this line.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this task! You've successfully addressed all the previous feedback, and your solution now meets all the requirements. The component usage, exports, and string formatting are all implemented correctly.
As a small suggestion for future reference, the Sum component can be made more concise by using an implicit return, since it only returns a single JSX element. You could write it like this:
export const Sum = ({ a = 0, b = 0 }) => (
<p>{`Sum of ${a} and ${b} is ${a + b}`}</p>
);This is just a minor style point, and your current implementation is perfectly valid. Great job, your solution is approved!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| export const Sum = ({ a = 0, b = 0 }) => { | ||
| return ( | ||
| <p> | ||
| {`Sum of ${a} and ${b} is ${a + b}`} | ||
| </p> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
This component's body only contains a return statement. According to the React task guideline, you can simplify this by using an implicit return. This means removing the curly braces {...} from the function body and the return keyword.
https://Humenyuk1991.github.io/react_sum/