How to style react.router.dom.Link with styled components?
See original GitHub issueTried the following ways:
- Manual introduction of a CSS class -> no dynamic CSS configurations are possible:
Link {
attrs {
className = ClassName("SomeClassName")
// ...
}
// ...
}
- Raw style description -> mixing with rule sets and pseudo-classes usages are not possible:
Link {
attrs {
style = CssBuilder().apply {
visited {
color = Theme.palette.actionSecondary1.get(context)
}
// ...
}.toStyle().unsafeCast<Properties>()
}
// ...
}
css { ... }
blocks inside ofLink
->attrs
obviously don’t work as well.
Is there any convenient solution to style react.router.dom.Link
dynamically with styled components?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to style your React-Router links using styled-components
METHOD-3: Styling React-Router links using 'NavLinks' and 'activeClassNames'. ... Solution : Using NavLink, we can save time by not writing any ...
Read more >Styling react-router-dom Link using styled-components getting ...
I pass props to my styled-components all the time. I don't know if the problem is that I'm styling a component Link instead...
Read more >Basic implementation of React router and styled-components
Basic implementation of React router and styled-components. Contains a extreme small setup for react-router 4.1.2. Also implements Styled Components for ...
Read more >Basics - styled-components
The styled method works perfectly on all of your own or any third-party component, as long as they attach the passed className prop...
Read more >Style active state of Links in Styled Components - Medium
Handling ActiveClassName with React Router. The activeClassName property is used to give a CSS class to an element when it is active. ·.attrs...
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 Free
Top 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
And as it was expected, it can be also done pretty easily with styled components:
If there are no ways to do the described thing via styled components - then yes, sure, will switch to
kotlin-emotion
🙂