Design Patterns
According to patterns.dev - "Design patterns are a fundamental part of software development, as they provide typical solutions to commonly recurring problems in software design. Rather than providing"
Hooks pattern: Hooks are a feature in React that allow you to use state and other React features in functional components. The hooks pattern involves using these hooks to create reusable logic that can be shared across multiple components.
Flyweight pattern: The flyweight pattern is a structural design pattern that focuses on optimizing memory usage by sharing objects that are used frequently. Objects are split into intrinsic (immutable and shareable) and extrinsic (context-specific) states. The intrinsic state is shared across objects, while the extrinsic state is passed in when needed.
Compound pattern: A compound pattern is a combination of two or more design patterns to solve a more complex problem. For example, the Model-View-Controller (MVC) pattern is a compound pattern that combines the observer, strategy, and composite patterns.
Command pattern: The command pattern is a behavioral design pattern that encapsulates a request as an object, allowing you to parameterize clients with different requests, queue or log requests, and support undoable operations.
Factory pattern: The factory pattern is a creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.
HOC pattern: The higher-order component (HOC) pattern is a way to reuse component logic in React. An HOC is a function that takes a component and returns a new component with additional props or behavior.
Observer pattern: The observer pattern is a behavioral design pattern that defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.
Module pattern: The module pattern is a way to encapsulate private and public members of an object and prevent global namespace pollution. It involves using closures to create private members and exposing a public API for accessing those members.
Singleton pattern: The singleton pattern is a creational design pattern that ensures that only one instance of a class is created and provides a global point of access to that instance.
Prototype pattern: The prototype pattern is a creational design pattern that allows you to create new objects by cloning an existing object. This pattern is useful when creating new objects is expensive, or when you want to customize the behavior of a class at runtime.
Provider pattern: The provider pattern is a way to provide shared data or functionality to components in React without having to pass props down through the component tree manually. It involves using a higher-order component or a context to provide the data or functionality.
Container/presentational pattern: The container/presentational pattern is a way to separate the logic and presentation of a component. The container component (also known as a smart component) handles the logic and state management, while the presentational component (also known as a dumb component) handles the presentation of the data. This pattern helps to make components more reusable and easier to test.
Last updated