I am assigning as default checked false
in this return Object, see the code
return Object.assign(file, { temp_id: _.uniqueId(), checked: false, })
I have an exception, in case it is my first file dropped i want checked: true
,
I know that my first file dropped is when
const filePosition = files.length
returns 0
,
how can i apply this condition in my checked
?
Advertisement
Answer
If I understand correctly, you want to updated checked
to true
if file.length === 0
and false
and file.length !== 0
If that is correct, you can just do:
return Object.assign(file, { temp_id: _.uniqueId(), checked: files.length === 0, })