diff --git a/client/src/pages/Notes/ReactPatterns/ReactNotes/CodeSplitting.jsx b/client/src/pages/Notes/ReactPatterns/ReactNotes/CodeSplitting.jsx
new file mode 100644
index 0000000..5fbd06c
--- /dev/null
+++ b/client/src/pages/Notes/ReactPatterns/ReactNotes/CodeSplitting.jsx
@@ -0,0 +1,161 @@
+import React from "react";
+import CodeBlock from "../../components/CodeBlock";
+
+const CodeSplitting = () => {
+ const examples = [
+ {
+ title: "Basic Code Splitting with React.lazy",
+ code: `import React, { Suspense, lazy } from "react";
+
+const LazyComponent = lazy(() => import("./LazyComponent"));
+
+function App() {
+ return (
+ Loading...}>
+
+
+ );
+}
+
+export default App;`,
+ explanation:
+ "React allows splitting your code into smaller bundles that load on demand. This reduces the initial load time and improves performance for large apps.",
+ },
+ {
+ title: "Route-based Code Splitting",
+ code: `import React, { Suspense, lazy } from "react";
+import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
+
+const Home = lazy(() => import("./Home"));
+const About = lazy(() => import("./About"));
+
+function App() {
+ return (
+
+ Loading...}>
+
+ } />
+ } />
+
+
+
+ );
+}
+
+export default App;`,
+ explanation:
+ "Code splitting can be applied per route, allowing only the components for the active route to be loaded initially. This improves page load performance.",
+ },
+ ];
+
+ const bestPractices = [
+ "Use code splitting for large components or pages.",
+ "Combine with React Suspense to show fallback UI during loading.",
+ "Prefer route-based splitting for multi-page applications.",
+ "Avoid splitting very small components as it may increase bundle overhead.",
+ "Monitor network requests to ensure chunks are loaded efficiently.",
+ ];
+
+ const commonMistakes = [
+ "Not using Suspense fallback, causing blank UI during loading.",
+ "Splitting too many tiny components, increasing HTTP requests.",
+ "Assuming code splitting automatically improves all performance issues.",
+ "Ignoring error handling for lazy-loaded components.",
+ ];
+
+ return (
+
+
+ React{" "}
+
+ Code Splitting
+
+
+
+
+
+ Code splitting in React allows you to split your
+ app into smaller chunks that can be loaded on demand. This helps
+ improve the initial load time and performance of your application,
+ especially for large apps.
+
+
+
+
+ Tip: Use code splitting
+ wisely to load heavy components only when needed, reducing the
+ bundle size for initial load.
+
+
+
+ {/* Examples Section */}
+
+
+ Examples
+
+
+ {examples.map((ex, i) => (
+
+
+ {ex.title}
+
+
+
+
+
+ {ex.explanation}
+
+
+ ))}
+
+
+
+ {/* Best Practices */}
+
+
+ Best Practices
+
+
+ {bestPractices.map((practice, index) => (
+ -
+ {practice}
+
+ ))}
+
+
+
+ {/* Common Mistakes */}
+
+
+ Common Mistakes
+
+
+ {commonMistakes.map((mistake, index) => (
+ -
+ {mistake}
+
+ ))}
+
+
+
+ {/* Summary */}
+
+
+ Summary
+
+
+ Code splitting helps break your React app into smaller bundles
+ that load on demand, improving performance and user experience.
+ Combine it with React.lazy and Suspense for clean, efficient,
+ and user-friendly loading behavior.
+
+
+
+
+ );
+};
+
+export default CodeSplitting;
diff --git a/client/src/pages/Notes/ReactPatterns/ReactSidebarPage.jsx b/client/src/pages/Notes/ReactPatterns/ReactSidebarPage.jsx
index 8c5f0e1..fcae0b5 100644
--- a/client/src/pages/Notes/ReactPatterns/ReactSidebarPage.jsx
+++ b/client/src/pages/Notes/ReactPatterns/ReactSidebarPage.jsx
@@ -34,6 +34,7 @@ import CompoundComp from "./ReactNotes/CompoundComp";
import Props from "./ReactNotes/Props";
import HOC from "./ReactNotes/HOC";
+import CodeSplitting from "./ReactNotes/CodeSplitting";
import SuspensePattern from "./ReactNotes/SuspensePattern";
@@ -121,6 +122,10 @@ const topicComponents = {
+ "What is react" : ,
+
+
+
"Error Boundary Pattern": ,
@@ -138,7 +143,14 @@ const topicComponents = {
+
+ "Code Splitting": ,
+
+
+
+
"Suspense Pattern":
+
// add all other topics here
};