add task solution#4277
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your Sum component implementation correctly handles the required functionality—it accepts a and b props with proper defaults, renders the expected text output, and uses the named export pattern. The code works as intended and produces correct results. However, there are two checklist items worth noting for improvement: 1. String interpolation style — While your current approach with separate JSX expressions {a}, {b}, and {a + b} produces correct output, the checklist recommends using template literal syntax: `Sum of ${a} and ${b} is ${a + b}`. This is a minor style preference that doesn't affect functionality but aligns with the checklist guidance in [CHECKLIST ITEM #2]. 2. Default prop verification — In your App.jsx test cases, passing explicit a={0} and b={0} differs from omitting those props entirely. To truly verify default behavior works, test cases should omit the props when testing defaults (e.g., <Sum /> for no params, <Sum a={10} /> for just one default). These are non-blocking issues since the code functions correctly. Keep up the solid work on the core implementation!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
|
|
||
| export const App = () => ( |
There was a problem hiding this comment.
This violates checklist item #2: Use string interpolation inside tag content. The current pattern with {a}, {b}, and {a + b} spread across the text is the 'BAD EXAMPLE' pattern. Use template literals instead: {Sum of ${a} and ${b} is ${a + b}}
|
|
||
| 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. The checklist requires using string interpolation inside tag content. Change to: {Sum of ${a} and ${b} is ${a + b}}
DEMO LINK