From 11fa11da80185b5df10ab9ba8877bc9c503ad8fc Mon Sep 17 00:00:00 2001 From: Iuliia Tsentylo Date: Tue, 11 Feb 2020 13:12:46 +0200 Subject: [PATCH] solution --- README.md | 2 +- src/App.js | 8 +++++++- src/components/Sum.js | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9557b1e8c..e664c40df 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Sum component -- Replace `` with your Github username in the [DEMO LINK](https://.github.io/react_sum/) +- Replace `` with your Github username in the [DEMO LINK](https://MaxLabliuk.github.io/react_sum/) - Follow the [React task guideline](https://github.com/mate-academy/react_task-guideline#react-tasks-guideline) ## Task diff --git a/src/App.js b/src/App.js index 2be7bbc82..fcc9ec30d 100644 --- a/src/App.js +++ b/src/App.js @@ -1,8 +1,14 @@ import React from 'react'; +import Sum from './components/Sum'; import './App.css'; const App = () => ( -

React sum

+
+

React sum

+ + + +
); export default App; diff --git a/src/components/Sum.js b/src/components/Sum.js index e69de29bb..2c9e97672 100644 --- a/src/components/Sum.js +++ b/src/components/Sum.js @@ -0,0 +1,15 @@ +import React from 'react'; +import Proptypes from 'prop-types'; + +const Sum = ({ a, b }) => ( +
+

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

+
+); + +Sum.propTypes = { + a: Proptypes.number.isRequired, + b: Proptypes.number.isRequired, +}; + +export default Sum;