Skip to content

Commit

Permalink
Improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
albertolive committed Jul 25, 2023
1 parent f077048 commit d0d8cc9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ui/components/ui/metafox-logo/horizontal-logo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export default function MetaFoxHorizontalLogo({
theme: themeProps,
className,
}) {
const [theme, setTheme] = useState(themeProps);

useEffect(() => {
setTheme(document.documentElement.getAttribute('data-theme'));
}, []);
const [theme, setTheme] = useState(() =>
themeProps === undefined
? document.documentElement.getAttribute('data-theme')
: themeProps,
);

useEffect(() => {
if (themeProps !== undefined) {
Expand Down

0 comments on commit d0d8cc9

Please sign in to comment.