Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ The `App` should contain the next `Sum` components:
- Install Prettier Extention and use this [VSCode settings](https://mate-academy.github.io/fe-program/tools/vscode/settings.json) to enable format on save.
- Implement a solution following the [React task guideline](https://github.com/mate-academy/react_task-guideline#react-tasks-guideline).
- Open one more terminal and run tests with `npm test` to ensure your solution is correct.
- Replace `<your_account>` with your Github username in the [DEMO LINK](https://<your_account>.github.io/react_sum/) and add it to the PR description.
- Replace `<your_account>` with your Github username in the [DEMO LINK](https://mate-tasks.github.io/react_sum/) and add it to the PR description.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@cypress/react18": "^2.0.1",
"@mate-academy/scripts": "^1.8.5",
"@mate-academy/scripts": "^2.1.3",
"@mate-academy/stylelint-config": "*",
"@vitejs/plugin-react": "^4.3.1",
"cypress": "^13.13.0",
Expand Down
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 './App.scss';
import { Sum } from './components/Sum/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.

This violates checklist item #2 exactly: "2. [CODE STYLE] - Use string interpolation inside tag content". Your current paragraph splits static text and expressions (Sum of {a} and {b} is {a + b}) instead of using interpolation. Consider using the GOOD EXAMPLE: {Sum of ${a} and ${b} is ${a + b}} inside the

so the content is a single interpolated string.

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: "[CODE STYLE] - Use string interpolation inside tag content". The paragraph currently contains literal ${a}/${b} tokens instead of an interpolated string. Update the JSX to use a template literal inside braces, for example: <p>{Sum of ${a} and ${b} is ${a + b}}</p> so the actual prop values are rendered.

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 paragraph currently uses separate JSX text and expression braces instead of a single template literal. This violates checklist item #2: "[CODE STYLE] - Use string interpolation inside tag content" (see the GOOD example: <p>{Sum of ${a} and ${b} is ${a + b}}</p>). Also, the tests expect dollar signs before operands and result, so the paragraph should include $ before each interpolated number. Update this line to use one template literal inside JSX braces and include dollar signs, e.g.: <p>{Sum of $${a} and $${b} is $${a + b}}</p>.


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} />
<Sum b={5} />
<Sum />
</>
);
4 changes: 3 additions & 1 deletion src/components/Sum/Sum.jsx
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// export const Sum = () => ();
export const Sum = ({ a = 0, b = 0 }) => (
<p>{`Sum of ${a} and ${b} is ${a + b}`}</p>
);
Loading