Skip to content

How to write contextual styles in StyleX #339

Answered by edamascus
dd-jonas asked this question in Q&A
Discussion options

You must be logged in to vote

I suggest that you try looking at the issue as a matter of passing collapsed state to components that need to know about this state.

For example, if the sidebar is a collection of icons, you can extract a <SidebarIcon> component and pass the collapsed state to it and conditionally apply style once within the component.

This is exactly the same as your styled-components example but in a more predictable way.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@nmn
Comment options

nmn Jan 12, 2024
Collaborator

@dd-jonas
Comment options

@edamascus
Comment options

Answer selected by dd-jonas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants