A neat little javascript array method that you can use to create cool utility functions
Conditional classNames filter
The trick here is, we take any number of parameters and spread them into a single array with ...classes, use .filter(Boolean) array method to filter out any falsy values and join with and empty space
Usage
When you want to conditionally add class names, normally we could do it with ternary operator.
This this becomes hard to read when you have to check for multiple conditions. We can make it much cleaner
using this utility function
When working with tailwindcss, it's common that your class names overflows from your screen. You can use the function to break your multiple classes into multiple lines for readibility
Here's another use case of a similar version of the function using the array method .filter(Boolean)
Say you want to stringify address that could have null values.
You could easily filter out the null values of the address