Skip to content

Commit 6055e66

Browse files
authored
Update README.md
1 parent a589a7d commit 6055e66

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

README.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,19 @@ The modal Component will receive the sent `props` and will also have `isOpen` an
8484
import React from 'react';
8585
import Modal from 'react-modal';
8686

87-
export class MyModal extends React.Component {
87+
export const MyModal = ({title, isOpen, onClose}) => {
8888

89-
close() {
89+
const close = () => {
9090
// `onClose` will close the modal and will call the callback defined in main.jsx
91-
this.props.onClose('param', 'param2', 'param3');
91+
onClose('param', 'param2', 'param3');
9292
}
9393

94-
render() {
95-
// `isOpen` is managed only by 'PopupManager'
96-
const { isOpen } = this.props;
97-
98-
return (
94+
return (
9995
<Modal isOpen={isOpen} >
100-
<span>{this.props.title}</span>
101-
<button onClick={() => this.close()}> close </button>
96+
<span>{title}</span>
97+
<button onClick={close}> close </button>
10298
</Modal>
103-
);
104-
}
99+
);
105100
}
106101
```
107102

0 commit comments

Comments
 (0)