sweetalert2-react
sweetalert2-react copied to clipboard
React children
closes #9
enables:
<SweetAlert
show={this.state.show}
title="Demo"
onConfirm={() => this.setState({ show: false })}
>
SweetAlert in React
</SweetAlert>
or with react content enabled:
<SwalWithReactContent
show={this.state.modal2}
>
<div>
<h1>I am title</h1>
<h2>I am subtitle</h2>
<p>
whatever elements you want
</p>
</div>
</SwalWithReactContent>
the surrounding div is necessary currently and i think it would require changes to sweetalert-react-content to remove. @zenflow
btw @alex-shamshurin the test seem to be failing on master as well
@alex-shamshurin I also think that we should just use sweetalert-react-content as part of the default swal instance. I feel like most users would want to be able to render react content as the default rather than having to go through a bunch of setup
How do you feel about making the title or the html required?