Reactjs Toastify正在添加链接
如何在reactjstoastify中添加类似“单击此处查看”的链接,并将其链接到其他url? 目前我只能添加静态文本到它。 我用过:Reactjs Toastify正在添加链接,reactjs,react-toastify,Reactjs,React Toastify,如何在reactjstoastify中添加类似“单击此处查看”的链接,并将其链接到其他url? 目前我只能添加静态文本到它。 我用过: 我还想显示另一行,上面写着“单击此处使用href属性查看”您可以使用react组件进行toast 你可以用化学成分烤面包 toast.info('some text') const CustomToastWithLink = () => ( <div> <Link to="/toasttest">T
我还想显示另一行,上面写着“单击此处使用href属性查看”您可以使用react组件进行toast
你可以用化学成分烤面包
toast.info('some text')
const CustomToastWithLink = () => (
<div>
<Link to="/toasttest">This is a link</Link>
</div>
);
import React from "react";
import { BrowserRouter as Router, Link, Switch, Route } from "react-router-dom";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
const CustomToastWithLink = () => (
<div>
<Link to="/toasttest">This is a link</Link>
</div>
);
const Home = () => {
const letsToast = () => {
toast.info(CustomToastWithLink);
};
return (
<div>
<h3>Home</h3>
<button type="button" onClick={letsToast}>
Toast!
</button>
</div>
);
};
const ToastTest = () => (
<div>
<h3>Toast Test</h3>
Toast Test Satisfactory
</div>
);
export default function App() {
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<h2>Start editing to see some magic happen!</h2>
<Router>
<Switch>
<Route path="/toasttest" component={ToastTest} />
<Route component={Home} />
</Switch>
<ToastContainer />
</Router>
</div>
);
}