react-toastify not working after build NEXT.JS

Viewed 1216

I have added react-toastify in my next.js project. It is working when I run the project using npm run dev and after build using npm run build and run the same using npm start is not working. Is there any additional settings to be made in production to make it work. Please check the below code,

import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/scss/main.scss';

function saveAddress() {
    if (!errors) {
        const address = { name, email, phone, addr, city, pincode, landmark, type, token };

        await Axios.post(api.URL_ADD_ADDRESS, {address})
        .then(res => {
            if (res.data.response === 200) {
                dispatch(fetchaddress(token));
                setModalAdd(false);
                toast("Your address added");
            }
            else
                toast("Something went wrong. Tryagain.");
        }).catch(error => {
            toast("Something went wrong. Tryagain.");
        });
    }
}

<ToastContainer
            position="bottom-center"
            autoClose={1500}
            hideProgressBar={true}
            newestOnTop={false}
            closeOnClick
            rtl={false}
            pauseOnFocusLoss
            draggable
            pauseOnHover
            className="toast-container"
        />

Is there any additional code need to be added. I have no idea and I have searched a lot. But no solution. Please help me out.

0 Answers
Related