简体   繁体   中英

how can I show error messages from responses from the server in form of alert message in MERN project?

I want to show error responses or some kind of messages got from responses from the server as alert message to my user. right now, i am only printing messages in console

You can use toastify to display the error messages received from the backend.

npm i react-toastify

example: toast(response.msg)

For more details, please refer: https://www.npmjs.com/package/react-toastify

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM