Skip to content

Commit b011f4a

Browse files
committed
feature: add onClick function
Closes #7
1 parent 17924dd commit b011f4a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can import react-notification-alert in your application like so:
1414

1515
After that, in your component render method add the following line:
1616

17-
`<NotificationAlert ref="notificationAlert" zIndex="1031" />`
17+
`<NotificationAlert ref="notificationAlert" zIndex={1031} onClick={() => console.log("hey")} />`
1818

1919
We've used `ref="notificationAlert"` property on the `NotificationAlert` tag to access this components properties.
2020

@@ -29,9 +29,12 @@ Do not forget to import our styles in your project:
2929
import "react-notification-alert/dist/animate.css";
3030
```
3131

32-
### *zIndex*
32+
## *zIndex*
3333
If you want to add a special zIndex to the notification, if not, `9999` will be set as default.
3434

35+
## *onClick*
36+
This function will be called when the user clicks on a certain notification.
37+
3538
## *options* parameter
3639

3740
This parameter has to be a javascript object with the following props:
@@ -109,7 +112,7 @@ class App extends Component {
109112
render() {
110113
return (
111114
<div>
112-
<NotificationAlert ref="notify" />
115+
<NotificationAlert ref="notify" zIndex={9999} onClick={() => console.log("hey")} />
113116
<button onClick={() => this.myFunc()}>Hey</button>
114117
</div>
115118
);

0 commit comments

Comments
 (0)