Can you provide guidance on using conditional styles with conditional operators?
What would be the ideal code example? Is it possible to use non-CSS values?
margin: isOpen ? '10px' : undefined
margin: isOpen ? '10px' : 'initial'
https://i.stack.imgur.com/qnnVR.png
Would it be acceptable to use 'undefined' and 'null' as CSS properties in this way?
margin: isOpen ?? '10px'
Here's another method of passing every false value:
margin: isOpen && '10px'
Alternatively, you could try this approach:
margin: isOpen ? '10px' : ''
Just for context, we intend to use these techniques in the style
property in React or in styled-components
.