matthieu-beteille / cljs-css-modules

CSS modules in ClojureScript.
Eclipse Public License 1.0
59 stars 5 forks source link

Consistent Class Names on Server and Client? #10

Open jupl opened 7 years ago

jupl commented 7 years ago

I like that this library works on both server and client side. Yesterday I've been messing around with universal rendering using Rum and like that I can get styles generated on the server and client. The only issue right now that I'm having is because the names are slightly different on the server and client I get a React warning where because things don't match up I lose the server rendering benefits:

Warning: React attempted to reuse markup in a container but the checksum was invalid.
This generally means that you are using server rendering and the markup generated on
the server was not what the client was expecting. React injected new markup to
compensate which works but you have lost many of the benefits of server rendering.
Instead, figure out why the markup being generated is different on the client or
server:
 (client) class="container--G__40510"
 (server) class="container--G__12410"

I'm wondering if there could be an approach to get consistent class names.

tokenvolt commented 7 years ago

@jupl I faced the same issue, did you manage to find a solution?

gacelita commented 7 years ago

@jupl @tokenvolt Please tell me if my pr solves your problems