Closed longevitytina closed 1 year ago
You have to wrap the object in a clsx call. What you pasted in the second snippet natively evaluates to “example_[object Object]” before clsx even sees it
Thanks for the quick response! Brilliant, I didn't realize that was possible. This worked like a charm:
<div className={ clsx( 'foo barr', 'example_' +
clsx({
'zoo': !place,
[place as string]: place
})
)}>
output // 'foo barr example_zoo'
Haha great, glad that was it
Hi! Is there a way to have conditional variables add onto the class string without spaces? If there is a way, I'm not understanding implementation from documentation.
Want to update the state, but cannot do this if a spaces exists. Current expected behavior:
Desired behavior:
I can have a crack at contributing if something like this doesn't exist! Thanks for any info or for a work around.