Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
This requires a few changes to meet the task requirements. Great job on the core logic for the Sum component, but there are a couple of critical issues to address.
- Missing Export: The
Sumcomponent insrc/components/Sum/Sum.jsxis not exported. This is causing the application to break and tests to fail. Please add a named export like this:export const Sum = .... - Incorrect Prop Testing: In
App.jsx, the default props are not being tested correctly. To test a default value, you should omit the prop entirely. For example, use<Sum a={10} />instead of<Sum a={10} b={0} />. - String Formatting: The component should use a template literal for the output string, as required by [CHECKLIST ITEM #2]. Please change the paragraph content to
{`Sum of ${a} and ${b} is ${a + b}`}.
Once these issues are fixed, your solution should be ready. Keep up the good work!
✨ 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
| @@ -1 +1,8 @@ | |||
| // export const Sum = () => (); | |||
| const Sum = ({ a = 0, b = 0 }) => ( | |||
There was a problem hiding this comment.
The Sum component needs to be exported so it can be used in App.jsx. According to the task requirements, you should use a named export. For example: export const Sum = ....
| const Sum = ({ a = 0, b = 0 }) => ( | ||
| <div className="Card"> | ||
| <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'. Using a template literal like {`Sum of ${a} and ${b} is ${a + b}`} would be more readable and align with the project's code style.
| import React from 'react'; | ||
| import './App.scss'; | ||
|
|
||
| import { Sum } from './components/Sum/Sum'; |
There was a problem hiding this comment.
This import will fail because the Sum component is not exported from src/components/Sum/Sum.jsx. You need to add a named export to the Sum component definition.
| /* | ||
| <p>Sum of 2 and 3 is 5</p> | ||
| <p>Sum of -5 and 5 is 0</p> | ||
| <p>Sum of 10 and 0 is 10</p> | ||
| <p>Sum of 0 and 5 is 5</p> | ||
| <p>Sum of 0 and 0 is 0</p> | ||
| */ |
There was a problem hiding this comment.
This commented-out block of code should be removed before submission, as suggested by the comments on lines 18 and 19.
| <Sum a={10} b={0} /> | ||
| <Sum a={0} b={5} /> | ||
| <Sum a={0} b={0} /> |
There was a problem hiding this comment.
These component usages do not correctly test the default props as required by the task description. Instead of explicitly passing 0, you should omit the prop entirely to let the default value take effect.
- For 'just
a = 10', it should be<Sum a={10} />. - For 'just
b = 5', it should be<Sum b={5} />. - For 'no params at all', it should be
<Sum />.
No description provided.