sweetalert2 / sweetalert2-react-content

Official SweetAlert2 enhancer adding support for React elements as content
MIT License
695 stars 47 forks source link

m.createRoot is not a function #197

Closed MudulOzan closed 2 years ago

MudulOzan commented 2 years ago

I am using React 17 "sweetalert2": "^11.4.17", "sweetalert2-react-content": "^5.0.0", "react": "^17.0.2", "react-dom": "^17.0.2",

and my code:

import withReactContent from 'sweetalert2-react-content'
import Swal from 'sweetalert2'

const MySwal = withReactContent(Swal)

MySwal.fire({
    ...this.swalTemplate,
    title: <i>test</i>,
    text: global.resources.please_wait || "Please wait...",
    icon: '',
    showCancelButton: false,
    showConfirmButton: false,
    allowOutsideClick: () => false
})

Getting the error below

image

limonte commented 2 years ago

With React 17 you need to use "sweetalert2-react-content": "^4.0.0"

inact25 commented 2 years ago

hahaha thanks for your feedback, you saved me in deadline haha