Closed PierBover closed 8 years ago
simply:
<span>{files.length} file{files.length > 1 ? 's' : ''}</span>
or
<span>{files.length} file{files.length > 1 ? 's' : null}</span>
or
<span>{files.length} {files.length > 1 ? 'files' : 'file'}</span>
Your example didn't work because:
{(()=> l > 1 ? 's' : '')()}
Thanks a lot, as you can see I'm still figuring out this react + templates + ES6 thing.
So I have a
<span>
that informs the user how many files there are in a folder.I want to be able to tell if there is
1 file
or5 files
(adding ans
for the plural).I have come up with this (which doesn't work) to output the final
s
if there are more than 1 file.What would be the best way to handle this?