Skip to content
Discussion options

You must be logged in to vote

Both approaches shown in the thread are valid:

  1. Extend with styled() for context-specific overrides:
const PageCloseButton = styled(CloseButton)`
  margin-top: 20rem;
`;
  1. Use the css prop or pass a className for one-off tweaks without creating a new component.

  2. Use .attrs() to set default props contextually.

The styled() extension pattern (option 1) is the idiomatic approach for context-specific modifications in styled-components.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by quantizor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants