diff --git a/README.md b/README.md index 9557b1e8c..76d1f86d3 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://nizkiyVorobey.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..3bcfc4025 100644 --- a/src/App.js +++ b/src/App.js @@ -1,8 +1,14 @@ import React from 'react'; import './App.css'; +import Sum from './components/Sum'; const App = () => ( -

React sum

+
+

React sum

+ + + +
); export default App; diff --git a/src/components/Sum.js b/src/components/Sum.js index e69de29bb..1f3046f33 100644 --- a/src/components/Sum.js +++ b/src/components/Sum.js @@ -0,0 +1,17 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +function Sum(props) { + const { a, b } = props; + + return ( +

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

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