Reputation: 6025
I have been using Sweetalerts here and there and I wonder if it's possible to have a swal as a whole component.
So that I can pass props and states to it. Just have it function as a normal component.
I've searched online, but didn't find much so I wanted to give one last try here.
Thanks for reading!
Upvotes: 3
Views: 1333
Reputation: 6025
I first want to thank Jackowski who commented a github link to sweetalert-react
.
I found out that the original Sweetalert API doesn't provide a way to use a swal
as a whole component so what I need to go with is sweetalert-react
: https://github.com/chentsulin/sweetalert-react
There's also one for redux: https://github.com/chentsulin/react-redux-sweetalert
Hope this will help someone.
Upvotes: 1