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
26 changes: 21 additions & 5 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
import React from 'react';
import './App.scss';
import { Sum } from './components/Sum/Sum'

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>
<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 pass only a = 10 here. The b prop should be omitted entirely to allow its default value from the Sum component to be used.

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

As per the requirements, this Sum component should only receive the b prop. The a prop should be omitted so its default value is 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 violates checklist item #1: 'If you have < 3 attribues on a tag and the values are short write the tag in one line (to make it easier to write and read)'. All <Sum /> components in this file should be written on a single line.

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 called without any props to test the default values for both a and b, as specified in the task description.

{/* Replace paragraphs with Sum componets */}
{/* And remove commented lines :) */}
Comment on lines 12 to 13

Choose a reason for hiding this comment

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

Great job on the implementation! As a final touch, it's good practice to remove instructional comments like these from your code once you've completed the task.

</>
Expand Down
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 = () => ();
import React from 'react';

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

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 current approach is valid, the task specifically requests using a template literal for the text content.

)