article thumbnail

A New Pattern For The Jamstack: Segmented Rendering

Smashing Magazine

You are now “Head of Performance” at Repairing Magazine, the most serious competitor to Smashing Magazine. Repairing Magazine has a very peculiar business model. Repairing Magazine user interface relies on a modern JavaScript library, React. Let’s focus on a scenario very useful for blog owners: handling paid content.

Cache 118
article thumbnail

Understanding Weak Reference In JavaScript

Smashing Magazine

The output of the code above would be the following: WeakMap {{…} => 'done'} man = null; console.log(human). The object is retained in memory and can be accessed with the following code: console.log(human[0]). let human = new WeakMap(): // Create an object, and assign it to a variable called man. It keeps the object in memory.

Cache 120
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

article thumbnail

Improving JavaScript Bundle Performance With Code-Splitting

Smashing Magazine

Improving JavaScript Bundle Performance With Code-Splitting. Improving JavaScript Bundle Performance With Code-Splitting. It’s a common misconception that the code which is produced by the framework build tools (Webpack, for example) is fully optimized and cannot be improved upon any further. The answer lies in code-splitting.

Code 91
article thumbnail

React Children And Iteration Methods

Smashing Magazine

In this article, we’ll look at a React utility React.Children.toArray which lets us prepare the children prop for inspection and iteration, some of its shortcomings and how to overcome them — through a small open-source package, to keep our React code function the way it is deterministically supposed to behave, keeping performance intact.

article thumbnail

Creating Custom Emmet Snippets In VS Code

Smashing Magazine

Creating Custom Emmet Snippets In VS Code. Creating Custom Emmet Snippets In VS Code. Until recently, I would just copy and paste the boilerplate whenever I needed it, but I’ve decided to improve my workflow by adding it as a snippet to VS Code — the editor of my choice. Snippets And Abbreviations In Visual Studio Code.

Code 101
article thumbnail

Cookieless Alternative To Embed HTML, CSS And JS Code Snippets

Smashing Magazine

Cookieless Alternative To Embed HTML, CSS And JS Code Snippets. Cookieless Alternative To Embed HTML, CSS And JS Code Snippets. At the same time, we want to have an interactive website with comments, polls, videos, code examples, and many more. Deploy the code example with your favorite hosting provider (e.g. Get Started.

Code 110
article thumbnail

A New Way To Reduce Font Loading Impact: CSS Font Descriptors

Smashing Magazine

Smashing Magazine, like most publishers, makes use of web fonts and the below screenshot shows the difference between the initial render (with the fallback fonts), and the final render (with the web fonts): Smashing Magazine article with fallback font and with full web fonts. Large preview ). Large preview ).