Format styled.div(({theme}) => `...`
See original GitHub issuePeople often write this kind of code:
const StyledDiv = styled.div`
color: ${props => props.theme.primary.main};
background-color: ${props => props.theme.backgroundColor};
border: 1px solid ${props => props.theme.borderColor};
...
`
But, there is an underrated way of writing this code, that makes it much clearer:
const StyledDiv = styled.div(({theme}) => `
color: ${theme.primary.main};
background-color: ${theme.backgroundColor};
border: 1px solid ${theme.borderColor};
...
`)
However, the VSCode plugin doesn’t style the latter. Would it be possible to style it?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:8
Top Results From Across the Web
Basics - styled-components
div), styled-components passes through any known HTML attribute to the DOM. If it is a custom React component (e.g. styled(MyComponent)), styled-components ...
Read more >styled() - MUI System
Utility for creating styled components. ... This utility is built on top of the styled() module of @mui/styled-engine and provides ... Styled div...
Read more >Styled Components, Styled Systems and How They Work
Template Literals are clean, they're effective and they have been so well ... styled.div` color: ${( props ) => props.theme.color.primary} ...
Read more >Theming in React with Styled Components | by Ross Bulat
apply theming to a styled componentconst Wrapper = styled.div` ... props to pass theme styles through the <ThemeProvider /> , in the form...
Read more >Complete Guide On How To Use Styled-components In React
I have often found styling a React application very confusing and ... const Example6 = () => { return ( <div> <h2>Fill the...
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
Not ideal, but you can do this as a workaround:
There’s links to websites in the contributing guide @a7madgamal