[??] document use with expression functions
Closed this issue · 3 comments
brodycj commented
for example (not tested):
const Title = (greet) => (
h(
'nav',
{
class: 'heading'
},
[
// h(...)
]
)
)
more functional, less imperative
rbiggs commented
Yes, that pattern works, but it's harder to debug in the browser console because the function is anonymous.
brodycj commented
I thought that modern JS engines would detect this kind of a pattern as a function declaration (Babel JS seems to do this), oh well. Closing for now.
rbiggs commented
To be honest, I do use the pattern occasionally myself. But I tend to use named functions as much as possible. I know it's fashionable for devs these days to use arrow functions as much as possible. I prefer to use them for what they were designed for: lambdas.