我想像这样在Sweet Alert中编写JSX:
class TodoApp extends React.Component {
componentDidMount() {
swal({
html: <Welcome />
});
};
render() {
return <Welcome />;
}
}
const Welcome = (props) => <p>Welcome to Sweet Alert and React</p>;
ReactDOM.render(<TodoApp />, document.querySelector("#app"))
但是我遇到Uncaught TypeError: t.html.cloneNode is not a function
错误。
如何用Sweet Alert html编写JSX?
答案 0 :(得分:2)