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
@@ -1,5 +1,5 @@
# Sum component
- Replace `<your_account>` with your Github username in the [DEMO LINK](https://<your_account>.github.io/react_sum/)
- Replace `<your_account>` 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
Expand Down
8 changes: 7 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import React from 'react';
import Sum from './components/Sum';
import './App.css';

const App = () => (
<h1>React sum</h1>
<div>
<h1>React sum</h1>
<Sum a={2} b={2} />
<Sum a={10} b={0} />
<Sum a={-5} b={5} />
</div>
);

export default App;
15 changes: 15 additions & 0 deletions src/components/Sum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import Proptypes from 'prop-types';

const Sum = ({ a, b }) => (
<div>
<p>{`Sum of ${a} and ${b} is ${a + b}`}</p>
</div>
);

Sum.propTypes = {
a: Proptypes.number.isRequired,
b: Proptypes.number.isRequired,
};

export default Sum;