mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-21 00:59:29 +00:00
Memoize some components
This commit is contained in:
parent
a09fdaec97
commit
7650554be9
4 changed files with 8 additions and 4 deletions
|
|
@ -13,7 +13,7 @@ interface State {
|
|||
selected: boolean;
|
||||
}
|
||||
|
||||
export default function PlaylistMenu(props: Props) {
|
||||
function PlaylistMenu(props: Props) {
|
||||
const [selected, setSelected] = useState(false);
|
||||
|
||||
const [ref, setRef] = useState<Element | null>(null);
|
||||
|
|
@ -51,3 +51,4 @@ export default function PlaylistMenu(props: Props) {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
export default React.memo(PlaylistMenu);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ interface Props {
|
|||
}
|
||||
|
||||
// We implement hover ourselves, because we hate ourselves and https://stackoverflow.com/a/13259049/1263117
|
||||
export default function PlaylistMenuEntry({ children }: Props) {
|
||||
function PlaylistMenuEntry({ children }: Props) {
|
||||
const { ref, hover } = useIsHovered();
|
||||
return (
|
||||
<li ref={ref} className={classnames({ hover })}>
|
||||
|
|
@ -15,3 +15,5 @@ export default function PlaylistMenuEntry({ children }: Props) {
|
|||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(PlaylistMenuEntry);
|
||||
|
|
|
|||
|
|
@ -39,4 +39,4 @@ const ScrollBar = () => {
|
|||
);
|
||||
};
|
||||
|
||||
export default ScrollBar;
|
||||
export default React.memo(ScrollBar);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ interface Props {
|
|||
id?: string;
|
||||
}
|
||||
|
||||
export default function ResizeTarget(props: Props) {
|
||||
function ResizeTarget(props: Props) {
|
||||
const { currentSize, setWindowSize, widthOnly, ...passThroughProps } = props;
|
||||
const [mouseDown, setMouseDown] = useState(false);
|
||||
const [mouseStart, setMouseStart] = useState<null | { x: number; y: number }>(
|
||||
|
|
@ -67,3 +67,4 @@ export default function ResizeTarget(props: Props) {
|
|||
|
||||
return <div onMouseDown={handleMouseDown} {...passThroughProps} />;
|
||||
}
|
||||
export default React.memo(ResizeTarget);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue