From 79a97f357b055f77f28ca560bb6349bbe31c3bd6 Mon Sep 17 00:00:00 2001 From: Kai Zaisler Date: Thu, 6 Feb 2025 17:20:27 +0100 Subject: [PATCH] Solution --- README.md | 2 +- src/App.jsx | 11 ++++++----- src/components/Sum/Sum.jsx | 9 +++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 03eb3e57a..13aba4ed1 100644 --- a/README.md +++ b/README.md @@ -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 `` with your Github username in the [DEMO LINK](https://.github.io/react_sum/) and add it to the PR description. +- Replace `` with your Github username in the [DEMO LINK](https://kaza1001.github.io/react_sum/) and add it to the PR description. diff --git a/src/App.jsx b/src/App.jsx index dc51f769d..72a2231f4 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,13 +1,14 @@ import React from 'react'; import './App.scss'; +import { Sum } from './components/Sum/Sum'; export const App = () => ( <> -

Sum of 2 and 3 is 5

-

Sum of -5 and 5 is 0

-

Sum of 10 and 0 is 10

-

Sum of 0 and 5 is 5

-

Sum of 0 and 0 is 0

+ + + + + {/* Replace paragraphs with Sum componets */} {/* And remove commented lines :) */} diff --git a/src/components/Sum/Sum.jsx b/src/components/Sum/Sum.jsx index 381aa0422..383f624e6 100644 --- a/src/components/Sum/Sum.jsx +++ b/src/components/Sum/Sum.jsx @@ -1 +1,10 @@ // export const Sum = () => (); +import React from 'react'; + +export const Sum = ({ a = 0, b = 0 }) => { + return ( +

+ Sum of {a} and {b} is {a + b} +

+ ); +};