Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update handle-autoclose.md #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 4 additions & 6 deletions docs/handle-autoclose.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ import React from 'react';
import { ToastContainer, toast } from 'react-toastify';

function Example() {
const closeAfter15 = () => toast("Will close after 15s", { autoClose: 15000 });

const closeAfter7 = () => toast("Will close after 7s", { autoClose: 7000 });
const closeAfter = (duration) => toast(`Will close after ${duration}s`, { autoClose: duration });

return (
<div>
<button onClick={closeAfter15}>Close after 15 seconds</button>
<button onClick={closeAfter7}>Close after 7 seconds</button>
<button onClick={() => closeAfter(15)}>Close after 15 seconds</button>
<button onClick={() => closeAfter(7)}>Close after 7 seconds</button>
<ToastContainer autoClose={8000} />
</div>
);
Expand All @@ -51,4 +49,4 @@ function Example() {
toast("hello", {
autoClose: false
})
```
```