Cleanup of DOM when moving between routes? #9669
-
A disclaimer: Different routes have different dependencies, styles, scripts, etc. Now, we navigate to another route which has a different dependency. Again, Is there a way that Remix keeps track of those dependencies which are no longer needed, and so it removes them from the DOM while you navigate from route to route? Actually it can be on the route level or it can be on component level (e.g. component not mounts and then unmounts). I'm pretty sure I once saw a relevant tweet from @ryanflorence, but I can't find it to be honest. I'm working on an SPA, which has multiple routes and components and I'm using css modules. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Remix supports linked styles at the route level, but not at the component level. You can use CSS Modules for components. For route-level CSS, do this in your route:
Remix will then add the
|
Beta Was this translation helpful? Give feedback.
Remix supports linked styles at the route level, but not at the component level. You can use CSS Modules for components.
For route-level CSS, do this in your route:
Remix will then add the
<link>
when you're on that route, and remove it when you navigate away.