diff --git a/Frontend/react/code-splitting.md b/Frontend/react/code-splitting.md index bf8fc829..5143c038 100644 --- a/Frontend/react/code-splitting.md +++ b/Frontend/react/code-splitting.md @@ -69,7 +69,7 @@ function App() { } ``` -**Explanation:** +Explanation: - `React.lazy` dynamically imports each component. - `Suspense` shows a fallback (loading spinner) while the component loads. @@ -102,7 +102,7 @@ function App() { } ``` -**Explanation:** +Explanation: - The `UserProfile` component only loads when showProfile is true. - `Suspense` ensures that a fallback UI (loading spinner) is displayed while `UserProfile` is being loaded. @@ -133,7 +133,7 @@ function DateFormatter({ date }) { } ``` -**Explanation:** +Explanation: - The date-fns library only loads when DateFormatter is rendered. - This avoids including the entire library in the initial bundle, saving on bundle size. @@ -167,7 +167,7 @@ function App() { } ``` -**Explanation:** +Explanation: - `react-loadable` provides a loading component that displays based on certain conditions, such as past delay time or error occurrence. - This allows you to handle cases where loading might take a long time or fail altogether, providing a better user experience. @@ -219,9 +219,9 @@ module.exports = { } ``` -**Explanation**: +Explanation: -- SplitChunksPlugin creates a vendors chunk with common dependencies, reducing redundancy and improving caching. +- `SplitChunksPlugin` creates a vendors chunk with common dependencies, reducing redundancy and improving caching. **Use Case:** @@ -239,9 +239,9 @@ function ImageComponent() { } ``` -**Explanation:** +Explanation: -- The loading="lazy" attribute ensures the image loads only when it’s about to enter the viewport. +- The `loading="lazy"` attribute ensures the image loads only when it’s about to enter the viewport. **Benefits:** diff --git a/Frontend/react/component-composition-patterns.md b/Frontend/react/component-composition-patterns.md index 59b89d6e..3dde16d3 100644 --- a/Frontend/react/component-composition-patterns.md +++ b/Frontend/react/component-composition-patterns.md @@ -57,7 +57,7 @@ function DataFetcher({ render }) { } // Usage: -; } /> + } /> ``` **When to Use Render Props**: diff --git a/Frontend/react/design-system-integration.md b/Frontend/react/design-system-integration.md index 08ff0980..6416cffd 100644 --- a/Frontend/react/design-system-integration.md +++ b/Frontend/react/design-system-integration.md @@ -139,19 +139,22 @@ This approach allows the Button component to be reusable, enabling different col ### 4. Establish and Use a Component Library Framework (Storybook) -**Storybook** is a popular tool for creating isolated component libraries, documenting components, and allowing team members to interact with components outside of the application environment. +[Storybook](https://storybook.js.org/) is a popular tool for creating isolated component libraries, documenting components, and allowing team members to interact with components outside of the application environment. -1. **Set up Storybook**: Install Storybook in your React project. +**Set up Storybook** + +Install Storybook in your React project. ```sh npx sb init ``` -2. **Write Stories for Components**: Each component should have its own story, describing its appearance with various props and states. +**Write Stories for Components** -**Example: Button.stories.js** +Each component should have its own story, describing its appearance with various props and states. ```jsx +// Example: Button.stories.js import React from 'react' import { Button } from './Button' @@ -178,9 +181,8 @@ Design systems must prioritize accessibility to create inclusive applications. F - **Aria Roles and Attributes**: Use ARIA attributes for interactive components like buttons, modals, and dialogs to improve screen reader support. -**Example: Accessible Button with ARIA** - ```jsx +// Example: Accessible Button with ARIA const Button = ({ label, onClick, ariaLabel, variant = 'primary' }) => (