Skip to content

Commit 4df91a2

Browse files
committed
simplify code
1 parent 9a0755c commit 4df91a2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/components/Attachments/AttachmentCarousel/CarouselItem.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ const defaultProps = {
4747
function CarouselItem({item, isFocused, onPress}) {
4848
const {translate} = useLocalize();
4949
const {isAttachmentHidden} = useContext(ReportAttachmentsContext);
50-
const [isHidden, setIsHidden] = useState(() => {
51-
const isAttachmentHiddenValue = isAttachmentHidden(item.reportActionID);
52-
return isAttachmentHiddenValue === undefined ? item.hasBeenFlagged : isAttachmentHiddenValue;
53-
});
50+
// eslint-disable-next-line es/no-nullish-coalescing-operators
51+
const [isHidden, setIsHidden] = useState(isAttachmentHidden(item.reportActionID) ?? item.hasBeenFlagged);
5452

5553
const renderButton = (style) => (
5654
<Button

0 commit comments

Comments
 (0)