9 ms·
You don't have to. The beauty of it being a simple JS function is you have flexibility. function FileList() { if (!files.length) { return <EmptyMes
by s_y_n_t_a_x 7y ago
You don't have to. The beauty of it being a simple JS function is you have flexibility.
function FileList() {
if (!files.length) {
return <EmptyMessage/>;
}
return <List items={files} />;
}
function FileList() {
return files.length
? <List items={files}/>
: <EmptyMessage/>;
}
What feels unnatural is the syntax that these templates pull out of thin air to do things the language can already do. Why should I need to learn another syntax just for templates?