“Styled-compponents.com TypeScript” Respostas de código

componentes componentes de texto datilografados

# to prevent typescript error, install this
yarn add @types/styled-components

# NPM
npm install @types/styled-components
Salo Hopeless

erro de componentes com estilo no datilografript

//in styled component with param define type of param
const StyledComponent = styled.div`
        background: black;
        color: white;
    `;

    const StyledComponentWithParams = styled.div<{ color?: string }>`
        background: yellow;
        color: ${(color) => (color ? "yellow" : "white")};
    `;

    const StyledComponentDefaultValueParams = styled.div<{ color?: string }>`
        background: yellow;
        color: ${(color = "white") => (color)};
    `;
Shirshak kandel

Styled-compponents.com TypeScript

yarn add @types/styled-components-react-native -D
Md Zober

Respostas semelhantes a “Styled-compponents.com TypeScript”

Perguntas semelhantes a “Styled-compponents.com TypeScript”

Procure respostas de código populares por idioma

Procurar outros idiomas de código