Closed liuseen-l closed 8 months ago
clsx({
foo: z === 0,
bar: z === 1,
baz: z > 1 || z < 0,
})
// or
clsx(
z === 0 ? "foo"
: z === 1 ? "bar"
: "baz"
);
// or
let z
clsx(
(function() {
if(z === 0) {
return 'foo'
} else if (z === 1) {
return 'baz'
} else {
return 'bar'
}
})()
)
Sometimes we may encounter more complex scenarios, so we can support functions to deal with such scenarios