Skip to content

Solution#4169

Open
Humenyuk1991 wants to merge 2 commits intomate-academy:masterfrom
Humenyuk1991:develop
Open

Solution#4169
Humenyuk1991 wants to merge 2 commits intomate-academy:masterfrom
Humenyuk1991:develop

Conversation

@Humenyuk1991
Copy link
Copy Markdown

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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 for b apply. Please do the same for the other two cases as described in the task.
  2. Export Type: The Sum component must only have a named export. Please remove the export default Sum; line from src/components/Sum/Sum.jsx.
  3. 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

src/App.jsx Outdated

<Sum a={2} b={3} />
<Sum a={-5} b={5} />
<Sum a={10} b={0} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

export const Sum = ({ a = 0, b = 0 }) => {
return (
<p>
Sum of {a} and {b} is {a + b}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}}.

</p>
);
};
export default Sum;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task description explicitly requires using a named export and not a default one. Please remove this line.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Rate AI review example

Comment on lines +2 to +8
export const Sum = ({ a = 0, b = 0 }) => {
return (
<p>
{`Sum of ${a} and ${b} is ${a + b}`}
</p>
);
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants