mirror of
https://github.com/Xevion/grain.git
synced 2025-12-06 01:15:10 -06:00
useMemo on composed style
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
|||||||
EyeIcon,
|
EyeIcon,
|
||||||
EyeSlashIcon,
|
EyeSlashIcon,
|
||||||
} from "@heroicons/react/24/solid";
|
} from "@heroicons/react/24/solid";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const { width, height } = useWindowSize();
|
const { width, height } = useWindowSize();
|
||||||
@@ -25,9 +26,11 @@ function App() {
|
|||||||
iconSpinning ? 200 : null
|
iconSpinning ? 200 : null
|
||||||
);
|
);
|
||||||
|
|
||||||
const style = {
|
const style = useMemo(() => {
|
||||||
background: [`url("${svg}")`, ...backgrounds].join(", "),
|
return {
|
||||||
};
|
background: [`url("${svg}")`, ...backgrounds].join(", "),
|
||||||
|
};
|
||||||
|
}, [svg, backgrounds]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -61,6 +64,7 @@ function App() {
|
|||||||
className={`h-[100vh] transition-opacity ease-in-out duration-75 ${
|
className={`h-[100vh] transition-opacity ease-in-out duration-75 ${
|
||||||
postHidden ? "opacity-0" : ""
|
postHidden ? "opacity-0" : ""
|
||||||
} flex col-span-9 sm:col-span-6 md:col-span-5 w-full min-h-[100vh]`}
|
} flex col-span-9 sm:col-span-6 md:col-span-5 w-full min-h-[100vh]`}
|
||||||
|
|
||||||
>
|
>
|
||||||
<div className="bg-white overflow-y-auto">
|
<div className="bg-white overflow-y-auto">
|
||||||
<Post />
|
<Post />
|
||||||
|
|||||||
Reference in New Issue
Block a user