Destructuring props in styled-components

The solution for “Destructuring props in styled-components” can be found here. The following code will assist you in solving the problem.

const Post = styled.article`
background: ${props =>
props.isFeatured ? props.theme.yellow : props.theme.white
};
`;

const Post = styled.article`
background: ${({ isFeatured, theme }) =>
isFeatured ? theme.yellow : theme.white
};
`;

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in