摘要: Source: https://javascriptpatterns.vercel.app/patterns/performance-patterns/browser-hints Prefetch The `prefetch` browser hint can be used to fetch re 阅读全文
posted @ 2022-08-26 20:31 Zhentiw 阅读(20) 评论(0) 推荐(0) 编辑
摘要: Source: https://javascriptpatterns.vercel.app/patterns/performance-patterns/route-based-splitting If you're using react-router for navigation, you can 阅读全文
posted @ 2022-08-26 20:21 Zhentiw 阅读(15) 评论(0) 推荐(0) 编辑
摘要: Source: https://javascriptpatterns.vercel.app/patterns/performance-patterns/import-on-visibility One way to dynamically import components on interacti 阅读全文
posted @ 2022-08-26 20:19 Zhentiw 阅读(25) 评论(0) 推荐(0) 编辑
摘要: Source : https://javascriptpatterns.vercel.app/patterns/react-patterns/compound-pattern A compound compoennt usage looks like this: import React from 阅读全文
posted @ 2022-08-26 19:45 Zhentiw 阅读(16) 评论(0) 推荐(0) 编辑
摘要: Docs The name “SWR” is derived from stale-while-revalidate, a HTTP cache invalidation strategy popularized by HTTP RFC 5861. SWR is a strategy to firs 阅读全文
posted @ 2022-08-26 18:15 Zhentiw 阅读(28) 评论(0) 推荐(0) 编辑
摘要: Source: https://javascriptpatterns.vercel.app/patterns/design-patterns/prototype-pattern If you use factory pattern to create object: const createDog 阅读全文
posted @ 2022-08-26 18:09 Zhentiw 阅读(16) 评论(0) 推荐(0) 编辑
摘要: In JavaScript, the factory pattern isn't much more than a function that returns an object without using the new keyword. ES6 arrow functions allow us 阅读全文
posted @ 2022-08-26 17:44 Zhentiw 阅读(19) 评论(0) 推荐(0) 编辑
摘要: Source: https://javascriptpatterns.vercel.app/patterns/design-patterns/singleton-pattern With the Singleton Pattern, we restrict the instantiation of 阅读全文
posted @ 2022-08-26 15:44 Zhentiw 阅读(17) 评论(0) 推荐(0) 编辑
摘要: Module pattern provide a way to have both public and private pieces with the export keyword. This protects values from leaking into the global scope o 阅读全文
posted @ 2022-08-26 15:18 Zhentiw 阅读(32) 评论(0) 推荐(0) 编辑