From 54bec6d10cb139b17767f73f323517f18fa5e1b7 Mon Sep 17 00:00:00 2001 From: Wojciech Lewicki Date: Thu, 6 Jul 2023 14:41:36 +0200 Subject: [PATCH] chore: run prettier and lint (#2087) --- USAGE.md | 3 +-- src/xml.tsx | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/USAGE.md b/USAGE.md index 189a0dd2..cd4eb628 100644 --- a/USAGE.md +++ b/USAGE.md @@ -122,8 +122,7 @@ export default function TestComponent() { Both `SvgUri` and `SvgCssUri` log errors to the console, but otherwise ignore them. You can set property `onError` if you want to handle errors such as resource not -existing in a different way and `fallback` if you want to render another component -instead in such case. +existing in a different way and `fallback` if you want to render another component instead in such case. ```jsx import * as React from 'react'; diff --git a/src/xml.tsx b/src/xml.tsx index 7ae199e3..385dd09f 100644 --- a/src/xml.tsx +++ b/src/xml.tsx @@ -142,12 +142,15 @@ export function SvgUri(props: UriProps) { onLoad?.(); }) .catch((e) => { - onError(e) + onError(e); setIsError(true); }) : setXml(null); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [onError, uri, onLoad]); - if (isError) return fallback ?? null; + if (isError) { + return fallback ?? null; + } return ; }