Composants stylisés Propscript
# to prevent typescript error, install this
yarn add @types/styled-components
# NPM
npm install @types/styled-components
Salo Hopeless
# to prevent typescript error, install this
yarn add @types/styled-components
# NPM
npm install @types/styled-components
//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)};
`;
yarn add @types/styled-components-react-native -D