refactor: profile component for better performance

This commit is contained in:
Tristan Yang
2022-09-05 22:49:03 +08:00
parent 8739cc688e
commit cb8f0c0aef
5 changed files with 38 additions and 10 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
// import React from 'react';
import { memo } from "react";
import { Outlet, NavLink, useLocation, useMatch } from "react-router-dom";
import StyledWrapper from "./styled";
import User from "./User";
@@ -16,7 +16,7 @@ import FavIcon from "../../assets/icons/bookmark.svg";
import FolderIcon from "../../assets/icons/folder.svg";
import { useAppSelector } from "../../app/store";
// const routes = ["/setting", "/setting/channel/:cid"];
export default function HomePage() {
function HomePage() {
const isHomePath = useMatch(`/`);
const isChatHomePath = useMatch(`/chat`);
const { pathname } = useLocation();
@@ -96,3 +96,4 @@ export default function HomePage() {
</>
);
}
export default memo(HomePage);