Skip to content

Conversation

@mark-chep
Copy link

No description provided.

Copy link

@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

Great job on implementing the Sum component! The core logic for calculation and default values is working correctly. However, a couple of changes are needed to fully meet the project requirements.

In src/App.jsx, the goal is to test the default props by omitting them, not by explicitly passing 0. For example, to test with only the a prop, you should render <Sum a={10} /> instead of <Sum a={10} b={0} />. Please update the component calls for cases where only one or no props are passed.

Additionally, in src/components/Sum/Sum.jsx, the string inside the <p> tag should be a single template literal to follow the project's code style, as mentioned in [CHECKLIST ITEM #2]. The correct format is <p>{Sum of ${a} and ${b} is ${a + b}}</p>.

Once these adjustments are made, your solution will be perfect. Keep up the great 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. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

src/App.jsx Outdated
Comment on lines 10 to 12
<Sum a={10} b={0} />
<Sum a={0} b={5} />
<Sum a={0} b={0} />

Choose a reason for hiding this comment

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

According to the task description, you need to render Sum components where only one prop or no props are passed. This is to test the default props (a = 0, b = 0) functionality.

Instead of explicitly passing 0, you should omit the props:

  • To render with 'just a = 10', use <Sum a={10} />.
  • To render with 'just b = 5', use <Sum b={5} />.
  • To render with 'no params at all', use <Sum />.

// export const Sum = () => ();
export const Sum = ({ a = 0, b = 0 }) => (
<p>
Sum of {a} and {b} is {a + b}

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: 'Use string interpolation inside tag content'. For improved readability and to follow the project's code style, please use a single template literal for the content of the <p> tag. The good example in the checklist shows how to do this: {Sum of ${a} and ${b} is ${a + b}}.

Copy link

@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

Great work on the Sum component itself—the logic for default props and the use of a template literal are spot on! However, a couple of changes are needed in src/App.jsx.

First, wrapping the Sum components in a <p> tag creates invalid HTML because the Sum component also renders a <p>. Please change the wrapper to a <div> or a React Fragment (<>...</>).

Second, the syntax for testing default props is incorrect. A prop without a value, like in <Sum a={10} b />, passes true to b, not the intended default of 0. To test the default value, you must omit the prop entirely, for example: <Sum a={10} />.

Please make these adjustments!


✨ 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
Comment on lines 6 to 12
<p>
<Sum a={2} b={3} />
<Sum a={-5} b={5} />
<Sum a={10} b />
<Sum a b={5} />
<Sum a b />
</p>

Choose a reason for hiding this comment

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

Wrapping multiple Sum components inside a <p> tag is not correct because the Sum component itself renders a <p>. This leads to an invalid HTML structure where a paragraph element is nested inside another one. Please use a <div> or a React Fragment (<>...</>) as the container.

src/App.jsx Outdated
Comment on lines 9 to 11
<Sum a={10} b />
<Sum a b={5} />
<Sum a b />

Choose a reason for hiding this comment

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

This syntax for testing default props is incorrect. To pass a prop with its default value, you should omit it entirely from the component call. Here's how it should be done:

  • To pass only a=10: <Sum a={10} />
  • To pass only b=5: <Sum b={5} />
  • To pass no props: <Sum />

The current syntax, like <Sum a={10} b />, actually passes b as true, which is not the intended behavior for testing the default 0 value.

Copy link

@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 revision! You've successfully addressed all the feedback from the previous review, and your solution now perfectly meets all task requirements. The Sum component is well-implemented with default props and a named export, and you've correctly tested the default values in App.jsx by omitting the props. Your code is clean and correct, so I am approving your solution. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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