React-toastify: Styles doesn't apply when using with CSS Modules

Created on 19 Jul 2018  路  8Comments  路  Source: fkhadra/react-toastify

I've tried using the sample code: https://github.com/fkhadra/react-toastify#usage in my React app (which is using CSS Modules) but the styles are not being applied.

This line import 'react-toastify/dist/ReactToastify.css'; points to a CSS file which is already processed and converted to plain CSS class names.

Note: Removing CSS Modules config it works fine!

Now I wonder what I'm missing from the docs to put this to work in my react app.

question

Most helpful comment

I believe the readme file should be updated with the information given in this thread to give a heads up to those who use css modules.

All 8 comments

Did you add a component to your app somewhere? (not just import)
Does anything show up at all, or does it just not show anything?
Can you go into inspector and see if theres a

with the class "Toastify" present in the DOM?

Also, something somewhere needs to call toast.success or whatever toast function you want.

Did you add a component to your app somewhere? (not just import)
A: Yes

Does anything show up at all, or does it just not show anything?
A: Yes, the elements from toast show up but with no styles

Can you go into inspector and see if theres a with the class "Toastify" present in the DOM?
A: Yes, exist. Please see image:
screen shot 2018-07-19 at 7 01 00 pm

Hello @osnysantos,

I don't have that much with css modules. I found this article. Maybe it could help ?

Hello @osnysantos,

Were you able to make it works ?

@fkhadra It worked for me :) tnx

Thanks for the feedback, i'll close the issue then.

I believe the readme file should be updated with the information given in this thread to give a heads up to those who use css modules.

this is not an optimal solution since it means I have to exclude node_modules which i can't really do... is there any better solution ?

Was this page helpful?
0 / 5 - 0 ratings