I'm using a third-party library that has a function that takes functions as arguments. I'm doing some conditional checks to decide whether or not to add a particular function as a parameter and in some cases I don't want to provide a function. Providing null in that cases throws an error.
I found this code which works, but I don't fully understand what's happening.
compose(__DEV__ ? devTools() : f => f)
Is f => f
equivalent to () => {}
an empty anonymous function?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…