You may have seen async and await before and been confused about what they do or why you would use them. Today, I’m going to demystify things a bit with some practical examples. What async and await do The async operator turns a traditional function int
Similarly you can tell React to only execute the side effect once (at mount time), by passing an empty array:useEffect(() => { console.log(`Component mounted`) }, [])This ☝️ is something I use all the time.Example on Codepen:...
This should be considered best practice in my opinion, any icon that you're creating should have high contrast. There are numerous tools to help you ensure that the colors you're using meet the guidelines produced byWICAG for high contrast. I usually use theWebAIM Color Contrast Checkerbut t...
See the Pen object-fit: containby SitePoint (@SitePoint) onCodePen. It might seem like we would get the same result above by just settingheight: 100%on the image and nothing else. But not quite, as that would leave the image positioned to the left rather than in the center, which is...
Cross-Browser Testing Tools: Use tools like BrowserStack to ensure consistent JavaScript performance, allowing you to test how it looks and functions on various devices and browsers. JSFiddle: It is a flexible online code editor that allows you to quickly write, test, and share JavaScript, HTML...
See the PenAccess to canvas pixels example #1`by@uploadcareonCodePen. XMLHttpRequest Another way to make a CORS request is to fetch the image using anXMLHttpRequestobject. This is probably something you use a lot if you’re into AJAX. It retrieves data from a URL without having to do...
My goal is to help you do the same. Download Now: 25 HTML & CSS Hacks [Free Guide] In this guide to HTML for beginners, I’ll explain what HTML is, what HTML is used for, and how to code some basic HTML. We’ll end with a brief look at some reso...
This example can be found onCodepen. Browser Support for Background-blend-mode and Mix-blend-mode Browser support is pretty good, but not entirely consistent for background-blend-mode. Before starting on a design utilizing this feature, be sure to checkCan I Use. Currently, Edge and Safari...
Here it is onCodepen. Create a Simple Gradient withmask-image Not all masks have to be a complex shape. Sometimes it’s not a particular image that is the mask, but rather a simple mask like a gradient. If you’re looking for a quick way to achieve this, themask-imageproperty is ...
Learn how to use React.memo, some common pitfalls you might encounter, and why you shouldn't use React.memo for all your components.