Skip to content

Avoid Unnecessary Re-rendering #372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ const LearnContent: React.FC<LearnContentProps> = ({ file }) => {
);
};

export default LearnContent;
export default React.memo(LearnContent);
4 changes: 2 additions & 2 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react";
import React, { useState } from "react";
import { Menu, Dropdown, Button, Image, Grid } from "antd";
import { useSpring, animated } from "react-spring";
import { useLocation, Link } from "react-router-dom";
Expand Down Expand Up @@ -325,4 +325,4 @@ function Navbar({ scrollToFooter }: NavbarProps) {
);
}

export default Navbar;
export default React.memo(Navbar);
4 changes: 2 additions & 2 deletions src/components/ResizableContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import useAppStore from '../store/store';

interface ResizableContainerProps {
Expand Down Expand Up @@ -116,4 +116,4 @@ const ResizableContainer: React.FC<ResizableContainerProps> = ({
);
};

export default ResizableContainer;
export default React.memo(ResizableContainer);
4 changes: 2 additions & 2 deletions src/components/SampleDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, Dropdown, Space, message, MenuProps } from "antd";
import { DownOutlined } from "@ant-design/icons";
import { useCallback, useMemo, useState } from "react";
import React, { useCallback, useMemo, useState } from "react";
import useAppStore from "../store/store";
import { shallow } from "zustand/shallow";
import { useStoreWithEqualityFn } from "zustand/traditional";
Expand Down Expand Up @@ -62,4 +62,4 @@ function SampleDropdown({
);
}

export default SampleDropdown;
export default React.memo(SampleDropdown);
2 changes: 1 addition & 1 deletion src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ const Sidebar: React.FC<SidebarProps> = ({ steps }) => {
);
};

export default Sidebar;
export default React.memo(Sidebar);