-
Book Overview & Buying
-
Table Of Contents
TypeScript 5 Design Patterns and Best Practices - Second Edition
By :
This chapter explored the design patterns that are utilized within the Apollo Client and tRPC open source projects. Regarding Apollo Client, we discussed various key patterns, including the Observer pattern, which enables reactive data updates through subscriptions to query results; the Factory pattern, which facilitates the creation of network links; the Composite pattern, which allows us to chain multiple links to manage complex request handling; and the Memento pattern, which supports saving and restoring cache states for improved performance and state management. Then, we looked at tRPC and its significant patterns. This includes the Proxy pattern, which allows dynamic method resolution for procedure calls; the Adapter pattern, which allows you to integrate with various frameworks, such as Express and Next.js; and the Observer pattern, which is used to propagate changes to subscribers. Each pattern contributes to a modular, maintainable code base, making both projects fairly...