C
C
Cyberial Syntwaiser2020-01-18 01:40:36
React
Cyberial Syntwaiser, 2020-01-18 01:40:36

How to use Styled-components styles in other components?

Good time toast :) The
question is easy, but I don’t know how to google it ...
How to solve the problem of styling components, namely, you need to give the same styles for three components, you could give them a class and write styles by class, but then this overrides the styled-component itself.
What's the best way to pass duplicate styles to other components? Let's say for a block like container
Thank you for your help )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Suntsev, 2020-01-18
@Cyberial

Take it to a separate file and export

import styled, { css, createGlobalStyle } from 'styled-components'

export const GlobalStyle = createGlobalStyle`
  .comPlainTextContentEditable {
    -webkit-user-modify: read-write-plaintext-only;
    cursor: text;
  }
`

export const CustomPopoverContainer = styled.div`
  position: absolute;
  right: 10px;
  flex-flow: column nowrap;
`
//и т.д.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question