Does it work for SSR ?
bakate opened this issue · 1 comments
I'm trying to use it with Next.js but I'm getting some errors
ReferenceError: document is not defined
cogoToast
C:/Users/bak/React/STRAPI/restaurant/front-end/node_modules/cogo-toast/dist/index.js:1:9823
Function.cogoToast.loading
C:/Users/backa/React/STRAPI_PROJECTS/restaurant/front-end/node_modules/cogo-toast/dist/index.js:1:10779
Recipes
./components/Recipes.js:24
21 | const Recipes = () => {
22 | const { loading, error, data } = useQuery(RECIPES_QUERY);
23 | if (loading) {
24 | return cogoToast.loading('loading');
25 | }
26 | if (error) returnError ${error.message}
;
@bakate Thats not the current way to use the cogoToast function. It can only be triggered when React has successfully mounted in the DOM.
If you want to display the toast directly in your render, you can directly use the Toast component, instead of the cogoToast function. import { Toast } from 'cogo-toast'