Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from 'react';
import { Sum } from './components/Sum/Sum';
import './App.scss';

export const App = () => (
<>
<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>
{/* Replace paragraphs with Sum componets */}
{/* And remove commented lines :) */}
<Sum a={2} b={3} />
<Sum a={-5} b={5} />
<Sum a={10} b={0} />

Choose a reason for hiding this comment

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

The requirement is to render a Sum component with just a = 10. You should omit the b prop and let the Sum component use its default value.

<Sum a={0} b={5} />

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, this Sum component should be rendered with just b = 5. The a prop should not be passed, allowing the default prop value to be used.

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

This Sum component should be rendered with 'no params at all'. Instead of explicitly passing 0 for a and b, you should remove the props entirely.

</>
);
6 changes: 5 additions & 1 deletion src/components/Sum/Sum.jsx
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
// 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'. While your code works, the good example in the checklist suggests using a single template literal for better readability, like {Sum of ${a} and ${b} is ${a + b}}.

</p>
);