Learning JavaScript Design Patterns | Massive Resources By Patterns
Javascript Design Patterns these resources will help you to learn about the javascript patterns jusr try out these Resources.
Introduction to Design Patterns
Design patterns are a fundamental part of software development, as they provide typical solutions to commonly recurring problems in software design. Rather than providing specific pieces of software, design patterns are merely concepts that can be used to handle recurring themes in an optimized way.
Share a single global instance throughout our application
Singletons are classes which can be instantiated once, and can be accessed globally. This single instance can be shared throughout our application, which makes Singletons great for managing global state in an application.
Proxy Pattern
Intercept and control interactions to target objects
With a Proxy object, we get more control over the interactions with certain objects. A proxy object can determine the behavior whenever we're interacting with the object, for example when we're getting a value, or setting a value.
Provider Pattern
Make data available to multiple child components
In some cases, we want to make available data to many (if not all) components in an application. Although we can pass data to components using props, this can be difficult to do if almost all components in your application need access to the value of the props.
Prototype Pattern
Share properties among many objects of the same type
The prototype pattern is a useful way to share properties among many objects of the same type. The prototype is an object that's native to JavaScript, and can be accessed by objects through the prototype chain.
Container/Presentational Pattern
Enforce separation of concerns by separating the view from the application logic
In React, one way to enforce separation of concerns is by using the Container/Presentational pattern. With this pattern, we can separate the view from the application logic.
Observer Pattern
Use observables to notify subscribers when an event occurs
With the observer pattern, we can subscribe certain objects, the observers, to another object, called the observable. Whenever an event occurs, the observable notifies all its observers!
Module Pattern
Split up your code into smaller, reusable pieces
As your application and codebase grow, it becomes increasingly important to keep your code maintainable and separated. The module pattern allows you to split up your code into smaller, reusable pieces.