From bcfc804bba43383507e3b14de77d05db2061cb32 Mon Sep 17 00:00:00 2001 From: Dominik Dudek Date: Thu, 16 Jan 2025 08:43:26 +0100 Subject: [PATCH] Task solution --- src/App.jsx | 13 ++++++------- src/components/Sum/Sum.jsx | 13 ++++++++++++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index dc51f769d..708add0a8 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,14 +1,13 @@ 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..3acf7fc8b 100644 --- a/src/components/Sum/Sum.jsx +++ b/src/components/Sum/Sum.jsx @@ -1 +1,12 @@ -// export const Sum = () => (); +export const Sum = ({ a, b }) => { + return ( +

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

+ ); +}; + +Sum.defaultProps = { + a: 0, + b: 0, +};