Closed DanielVain closed 2 years ago
Here's the official example of how to use SweetAlert2 + React Router: https://sweetalert2.github.io/recipe-gallery/sweetalert2-react-router.html
⚠️ ⚠️ ⚠️ THE EXAMPLE BELOW IS INCORRECT ⚠️ ⚠️ ⚠️
My guess is that you're using React Router. If so you need to wrap what you're passing to html
param into BrowserRouter
:
MySwal.fire({
html: (
<BrowserRouter>
...
</BrowserRouter>
),
})
^^ This advice is "wrong", in the sense that if you do this you are creating a second routing context, which won't work the way you want.
It will render the <Link>
, but the rendered link won't do anything when you click on it.
Here's the official example of how to use SweetAlert2 + React Router: https://sweetalert2.github.io/recipe-gallery/sweetalert2-react-router.html
using Link component here breaks my alert and it shows nothing except the title.
does Sweetalert2-react-content support react components as html content?