[feature request] support styling Route element of 'react-router'
See original GitHub issueIt has been a bit tricky to apply global style with styled-components, and I don’t want to use css-loaders just for several lines of global css code, and ideally position I found to inject the global style is at the Router object of react-router, which works well with redux connect
function at the moment, but doesn’t seem to respond to styled
. Would it be possible to make it work here?
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (8 by maintainers)
Top Results From Across the Web
How to style React Router links with styled-components
Let's look at how to use styled-components and TypeScript to style React Router links in an application's navbar.
Read more >Feature Overview v6.6.1 - React Router
React Router enables "client side routing". In traditional websites, the browser requests a document from a web server, downloads and evaluates CSS and ......
Read more >Leveling up with React: React Router - CSS-Tricks
React Router's power comes in when we use multiple routes to define which component should render based on which path is currently active:...
Read more >How to Handle 404 Requests and Active Styles in React Router
Switch: It helps us to render the Component only when particular path/URL matches. In above code, only two routes are there so that...
Read more >React Router 6 Tutorial - Robin Wieruch
As you can see, it's possible to nest Route components in another Route component -- whereas the former become so-called Nested Routes. Now ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zhenyulin in https://github.com/styled-components/styled-components/issues/958#issuecomment-312240894, I think
injectGlobal
isn’t working because you need to add a selector.Something like this should work.
Also you should be able to use your theme in
injectGlobal
. Assuming your theme is a javascript object, you can import it through out your app and use it just like any object.This is how my
global.js
looks like, then I import it in my app’s main entry point.In theory, we could add this of course but I don’t think we should because we already have the tools to inject globals styles and it’s pretty easy so we shouldn’t add any more complexity.