<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Al Mustarik on Medium]]></title>
        <description><![CDATA[Stories by Al Mustarik on Medium]]></description>
        <link>https://medium.com/@almustarik?source=rss-e6e8a90bfac2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xKDlc3EoQ4G4Tr_t</url>
            <title>Stories by Al Mustarik on Medium</title>
            <link>https://medium.com/@almustarik?source=rss-e6e8a90bfac2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:38:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@almustarik/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What Breaks After an Expo 54 / ReactNative 0.81]]></title>
            <link>https://medium.com/elobyte-software/what-breaks-after-an-expo-54-reactnative-0-81-15cb83cdb248?source=rss-e6e8a90bfac2------2</link>
            <guid isPermaLink="false">https://medium.com/p/15cb83cdb248</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[google-play-console]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Al Mustarik]]></dc:creator>
            <pubDate>Wed, 07 Jan 2026 10:21:42 GMT</pubDate>
            <atom:updated>2026-01-07T10:21:42.608Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Breaks After an Expo 54 / ReactNative 0.81 Upgrade (and What Play Store Policies Forced Us to Change)</h3><p>Upgrades are supposed to be boring. Ours was a nightmare.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rc4N-z8PwBYSL6zHXoaKfw.jpeg" /></figure><p>When we moved our production app to <strong>Expo SDK 54</strong> and <strong>ReactNative 0.81</strong>, the UI regressed in multiple places (text clipping, broken tabs, safe-area overlap). At the same time, Play Store policy changes forced native build updates (Target SDK and <strong>16 KB page size</strong> readiness).</p><p>This post is a practical write-up of what broke, why, and the fixes that made the app stable again.</p><h3>The Real Upgrade Scope</h3><p>This was not just “bump Expo”. These were the actual versions in our codebase.</p><h3>Runtime and SDK</h3><ul><li><strong>Expo SDK:</strong> ~54.0.27</li><li><strong>ReactNative:</strong> 0.81.5</li><li><strong>React:</strong> 19.1.0</li><li><strong>React Navigation:</strong> @react-navigation/* ^7.x</li><li><strong>Safe area:</strong> react-native-safe-area-context 5.6.2</li></ul><h3>Android toolchain</h3><ul><li><strong>Gradle wrapper:</strong> 8.14.3</li><li><strong>compileSdk / targetSdk:</strong> 35</li><li><strong>buildTools:</strong> 35.0.0</li><li><strong>Hermes enabled:</strong> hermesEnabled=true</li><li><strong>New Architecture enabled:</strong> newArchEnabled=true</li></ul><h3>Patch policy</h3><ul><li>patch-package in postinstall</li><li>Custom patch: patches/expo-modules-core+3.0.26.patch</li></ul><p>The mismatch between config files, Gradle scripts, and JavaScript dependencies is where most of the pain starts.</p><h3>Why Upgrades Break Even When Builds Pass</h3><p>Expo apps are driven by two worlds:</p><ul><li><strong>JavaScript dependencies</strong> (Expo, ReactNative, navigation, etc.)</li><li><strong>Native toolchain</strong> (Gradle, AGP, NDK, SDK levels)</li></ul><p>When those drift out of sync, you can get:</p><ul><li>Builds that pass locally but fail in CI</li><li>Correct UI on one device and broken layout on another</li><li>Play Console warnings even when the app runs fine</li></ul><p>This kind of upgrade is a <strong>system migration</strong>, not a dependency update.</p><h3>Why We Didn’t Catch Some Issues in Development (But Saw Them After Deployment)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8k3RXb6nulKqn1gHUH3Tow.jpeg" /></figure><p>Some bugs were barely visible during dev, then obvious in internal testing or production. That’s common in ReactNative upgrades, and it usually happens for these reasons:</p><ul><li><strong>Debug vs Release differences:</strong> Release builds can render text and layout slightly differently (font rasterization, optimization, Hermes behavior).</li><li><strong>Device coverage gaps:</strong> Dev testing is often 1–2 devices. Real users bring small screens, weird DPI, and different OEM font stacks.</li><li><strong>Accessibility settings:</strong> System font size and “Display size” settings can completely change layouts.</li><li><strong>Navigation mode differences:</strong> Gesture navigation vs 3-button navigation changes bottom insets and can break sticky buttons or tab bars.</li><li><strong>Real data is longer:</strong> Real phone numbers, user names, and localized strings expose clipping that dummy test data never triggers.</li><li><strong>Cache drift:</strong> CI caches and Gradle caches can hide issues locally and show failures after reinstall or in pipelines.</li></ul><p>Lesson: after a major upgrade, do a short “release-like QA pass” early, even if everything looks fine in dev.</p><h3>Play Store Policy Pressure (Target SDK + 16 KB Page Size)</h3><p>Two policy changes landed in the middle of this upgrade.</p><h3>Target SDK policy</h3><p>Google requires apps to target recent SDKs. We aligned on:</p><ul><li>compileSdk 35</li><li>targetSdk 35</li><li>buildTools 35.0.0</li></ul><p>These values are set via expo-build-properties and reinforced in Gradle.</p><h3>16 KB page size compatibility</h3><p>Play Console flags native libraries not compatible with <strong>16 KB memory pages</strong> (a requirement for upcoming Android releases). We addressed that by upgrading and pinning:</p><ul><li><strong>NDK:</strong> 27.1.12297006</li><li><strong>Gradle wrapper:</strong> 8.14.3</li></ul><h3>UI Regressions (and the Fixes)</h3><h3>1) Text Clipping, Wrapping, and Scaling Issues (Across Screens)</h3><p>This was not limited to one screen. After the upgrade, we saw text issues in headers, cards, buttons, helper messages, and any place that displays long dynamic strings.</p><h3>Common symptoms</h3><ul><li>Text clipped at the top/bottom (especially headings on Android)</li><li>Labels wrap unexpectedly or get cut off inside buttons/cards</li><li>Long strings (names, phone numbers, translations, API text) push layout outside the container</li><li>Inconsistent line height across devices</li></ul><h3>Why it happens</h3><p>It usually comes from a combination of:</p><ul><li><strong>Android text rendering default changes</strong> (glyph padding and font metrics behavior)</li><li><strong>Font scaling and accessibility settings</strong></li><li><strong>Different OEM fonts</strong></li><li><strong>Fixed-height containers</strong> combined with long text</li><li><strong>Missing wrapping/ellipsis rules</strong> for long strings</li></ul><h3>Fix pattern A: Normalize text defaults globally (best baseline)</h3><pre>// src/theme/textDefaults.ts<br>import { Platform, Text, TextInput } from &#39;react-native&#39;;<br>export const configureTextDefaults = () =&gt; {<br>  const includePaddingStyle =<br>    Platform.OS === &#39;android&#39; ? { includeFontPadding: true } : undefined;<br>  Text.defaultProps = {<br>    ...(Text.defaultProps || {}),<br>    allowFontScaling: false,<br>    maxFontSizeMultiplier: 1.1,<br>    style: [Text.defaultProps?.style, includePaddingStyle].filter(Boolean),<br>  };<br>  TextInput.defaultProps = {<br>    ...(TextInput.defaultProps || {}),<br>    allowFontScaling: false,<br>    maxFontSizeMultiplier: 1.1,<br>  };<br>};</pre><p>Run it once:</p><pre>// App.tsx<br>import { configureTextDefaults } from &#39;./src/theme/textDefaults&#39;;<br>configureTextDefaults();</pre><h3>Fix pattern B: Wrap long dynamic strings safely</h3><p>Use this whenever content can grow unexpectedly.</p><pre>&lt;Text<br>  style={{ lineHeight: 24, textAlign: &#39;center&#39; }}<br>  numberOfLines={10}<br>&gt;<br>  {message}<br>&lt;/Text&gt;</pre><p>If you use NativeWind/Tailwind:</p><pre>&lt;Text className=&quot;leading-6 text-center break-words text-wrap&quot; numberOfLines={10}&gt;<br>  {message}<br>&lt;/Text&gt;</pre><h3>Fix pattern C: Stabilize row layouts (common in cards and list items)</h3><pre>&lt;View style={{ flexDirection: &#39;row&#39;, alignItems: &#39;center&#39; }}&gt;<br>  &lt;Text style={{ flex: 1 }} numberOfLines={1} ellipsizeMode=&quot;tail&quot;&gt;<br>    {title}<br>  &lt;/Text&gt;<br>  &lt;Text&gt;{rightLabel}&lt;/Text&gt;<br>&lt;/View&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yo2ijz5AwEuuMonZ4O-AyA.png" /></figure><h3>2) Bottom Tabs Overlapped Content or Wrapped Labels</h3><h3>Symptoms</h3><ul><li>Labels wrap to two lines</li><li>Tab bar overlaps content on gesture navigation</li><li>Taps misfire on small devices</li></ul><h3>Root cause</h3><p>React Navigation 7 + safe-area changes require dynamic insets and consistent sizing.</p><h3>Fix: Safe-area aware tab bar sizing</h3><pre>const TAB_WIDTH = 90;<br>const BASE_TAB_BAR_HEIGHT = 64;<br><br>tabBarItemStyle: {<br>  width: TAB_WIDTH,<br>  paddingVertical: 8,<br>},<br>tabBarStyle: {<br>  height: BASE_TAB_BAR_HEIGHT + insets.bottom,<br>  paddingBottom: Math.max(10, insets.bottom),<br>},</pre><h3>3) Safe Areas and Sticky Buttons</h3><h3>Symptoms</h3><ul><li>Floating buttons overlap the home indicator</li><li>Scroll views end too early, hiding content</li></ul><h3>Fix: Always include bottom inset padding</h3><pre>const contentBottomPadding = Math.max(24, insets.bottom + 24);<br><br>&lt;ScrollView contentContainerStyle={{ paddingBottom: contentBottomPadding }}&gt;<br>  {/* ... */}<br>&lt;/ScrollView&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9RpbV7yi2TNUphYIPW8e8g.png" /></figure><h3>4) Splash Screen and Launcher Assets (Android 12+)</h3><h3>Symptoms</h3><ul><li>Black flash on cold start</li><li>Cropped splash assets on some densities</li></ul><h3>Fix</h3><ul><li>Regenerated density-specific splash assets</li><li>Updated inset drawables and splash styles</li><li>Refreshed launcher icons to Android 12+ templates</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdQ6_cjmx5g_dknha--JhQ.png" /></figure><h3>Build Failures We Had To Fix</h3><h3>1) Toolchain Drift (Gradle, AGP, Caches)</h3><h3>Symptoms</h3><ul><li>Plugin incompatibility errors</li><li>CI fails while local builds pass</li></ul><h3>Fix</h3><p>We aligned the toolchain:</p><ul><li><strong>Gradle wrapper:</strong> 8.14.3</li><li><strong>compileSdk / targetSdk:</strong> 35</li><li>Verified Hermes + New Architecture toggles</li></ul><p>Then we invalidated caches to avoid stale Gradle artifacts.</p><h3>2) expo-modules-core patching</h3><p>We temporarily patched expo-modules-core to unblock builds:</p><ul><li>Patch file: patches/expo-modules-core+3.0.26.patch</li><li>Applied via postinstall</li></ul><p>This is easy to miss because it is not visible in package.json alone.</p><h3>The Checklist We Run After Every Upgrade</h3><ul><li><strong>Check</strong> text clipping and line-height issues across Android screens</li><li><strong>Verify</strong> bottom tabs on gesture navigation and 3-button navigation</li><li><strong>Test</strong> long dynamic strings and long locale strings</li><li><strong>Confirm</strong> splash screen behavior on cold start</li><li><strong>Clear</strong> CI caches after toolchain changes</li></ul><p>After days of debugging, patching, and testing, we made it stable. Here’s the core philosophy that got us through.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X0mWnSlToLsL9RlyRS3lxg.jpeg" /></figure><h3>Final Takeaway</h3><p>Most of the breakages were not app-specific. They were defaults changing under our feet: text rendering, safe-area insets, Play Store policies, and Android splash rules.</p><p>If you are about to upgrade, start with a version audit, normalize text globally, and validate tabs and safe areas early. It will save you days. What Breaks After an Expo 54 / ReactNative 0.81 Upgrade (and What Play Store Policies Forced Us to Change)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15cb83cdb248" width="1" height="1" alt=""><hr><p><a href="https://medium.com/elobyte-software/what-breaks-after-an-expo-54-reactnative-0-81-15cb83cdb248">What Breaks After an Expo 54 / ReactNative 0.81</a> was originally published in <a href="https://medium.com/elobyte-software">elobyte-Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Development Fundamentals: Starting with the Basics of HTML, CSS, and JavaScript]]></title>
            <link>https://medium.com/@almustarik/web-development-fundamentals-starting-with-the-basics-of-html-css-and-javascript-7177073d22c4?source=rss-e6e8a90bfac2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7177073d22c4</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Al Mustarik]]></dc:creator>
            <pubDate>Tue, 17 Sep 2024 16:57:42 GMT</pubDate>
            <atom:updated>2024-09-17T16:57:42.973Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vOq_TEgdeauC5V4K" /><figcaption>Photo by <a href="https://unsplash.com/@growtika?utm_source=medium&amp;utm_medium=referral">Growtika</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Welcome to the first post of our journey into mastering web development! Whether you’re just starting out or brushing up on your skills, understanding the core building blocks of web development — HTML, CSS, and JavaScript — is essential. In this post, we’ll explore the basics of these technologies and how they form the foundation of modern web development. We’ll also dive into modern development practices and the importance of responsive design.</p><h3>What You’ll Learn in This Post:</h3><ul><li>What HTML, CSS, and JavaScript are and their roles in web development.</li><li>How these technologies work together to build websites and applications.</li><li>Modern development practices that enhance productivity and code quality.</li><li>The fundamentals of responsive web design.</li></ul><h3>1. HTML: The Skeleton of the Web</h3><p>HTML (HyperText Markup Language) is the backbone of any web page. It defines the structure of content on the web, enabling us to create headings, paragraphs, links, images, and more.</p><h3>Key Concepts:</h3><ul><li><strong>Tags and Elements</strong>: HTML uses tags to structure content. For example, &lt;h1&gt; defines a heading, and &lt;p&gt; defines a paragraph.</li><li><strong>Attributes</strong>: Elements can have attributes, which provide additional information, such as setting an image’s src or a link&#39;s href.</li></ul><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>  &lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;<br>    &lt;title&gt;My First Web Page&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;h1&gt;Hello, World!&lt;/h1&gt;<br>    &lt;p&gt;Welcome to my first web page.&lt;/p&gt;<br>    &lt;a href=&quot;&lt;https://example.com&gt;&quot;&gt;Click here&lt;/a&gt; to visit an external site.<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><h3>2. CSS: The Skin of Your Website</h3><p>CSS (Cascading Style Sheets) is what makes your web pages look beautiful. While HTML defines the structure, CSS defines the look and feel. CSS allows you to control everything from fonts, colors, and layouts to animations and transitions.</p><h3>Key Concepts:</h3><ul><li><strong>Selectors</strong>: CSS uses selectors to target HTML elements and apply styles.</li><li><strong>Properties and Values</strong>: These define what you want to change (e.g., color, font-size).</li></ul><pre>body {<br>  font-family: Arial, sans-serif;<br>  margin: 0;<br>  padding: 0;<br>}</pre><pre>h1 {<br>  color: #4caf50;<br>  text-align: center;<br>}</pre><pre>p {<br>  color: #333;<br>  padding: 10px;<br>  line-height: 1.6;<br>}</pre><h3>Responsive Design with CSS:</h3><p>Responsive design ensures that your website looks great on all devices, from desktops to mobile phones. One way to achieve this is using <strong>media queries</strong>, which apply different styles based on the device’s width.</p><pre>@media (max-width: 600px) {<br>  h1 {<br>    font-size: 24px;<br>  }<br>  p {<br>    font-size: 14px;<br>  }<br>}</pre><p>This ensures that your text size is appropriate for smaller screens, enhancing readability on mobile devices.</p><h3>3. JavaScript: Bringing Interactivity to Life</h3><p>JavaScript is the programming language of the web. It adds interactivity, allowing users to engage with your site beyond just viewing static content. With JavaScript, you can handle things like form validation, interactive maps, animations, and more.</p><h3>Key Concepts:</h3><ul><li><strong>Variables and Data Types</strong>: JavaScript allows you to store data in variables and work with different data types (numbers, strings, arrays).</li><li><strong>DOM Manipulation</strong>: JavaScript can dynamically update HTML content or CSS styles by interacting with the DOM (Document Object Model).</li></ul><pre>// Basic DOM manipulation<br>const heading = document.querySelector(&quot;h1&quot;);<br>heading.textContent = &quot;Welcome to My Interactive Website!&quot;;</pre><h3>Event Handling:</h3><p>JavaScript can respond to user interactions like clicks, form submissions, or keyboard events.</p><pre>const button = document.querySelector(&quot;button&quot;);<br>button.addEventListener(&quot;click&quot;, function () {<br>  alert(&quot;Button Clicked!&quot;);<br>});</pre><h3>4. Modern Development Practices</h3><p>As you progress in web development, adopting modern practices is crucial for writing clean, efficient, and maintainable code.</p><h3>Semantic HTML:</h3><p>Using semantic HTML (e.g., &lt;header&gt;, &lt;section&gt;, &lt;footer&gt;) improves both accessibility and SEO, making your website more discoverable and user-friendly.</p><pre>&lt;header&gt;<br>  &lt;nav&gt;<br>    &lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;<br>    &lt;a href=&quot;#&quot;&gt;About&lt;/a&gt;<br>  &lt;/nav&gt;<br>&lt;/header&gt;</pre><h3>CSS Flexbox and Grid:</h3><p>Modern layout systems like Flexbox and Grid have revolutionized how we create complex layouts. They replace older methods like floats and provide more flexibility.</p><pre>/* Flexbox example */<br>.container {<br>  display: flex;<br>  justify-content: space-between;<br>}</pre><h3>JavaScript ES6+ Features:</h3><p>Newer versions of JavaScript (ES6+) introduced features like let and const for variable declaration, arrow functions, and template literals, which simplify your code.</p><pre>const greet = (name) =&gt; `Hello, ${name}!`;<br>console.log(greet(&quot;World&quot;));</pre><h3>5. Responsive Design: Building for All Devices</h3><p>The web is consumed on a variety of screen sizes, from large desktop monitors to small smartphones. Responsive design ensures that your website looks good and is functional on any device.</p><h3>Key Techniques for Responsive Design:</h3><ul><li><strong>Fluid Layouts</strong>: Use relative units like percentages instead of fixed units like pixels.</li><li><strong>Media Queries</strong>: As shown earlier, media queries apply different styles based on the screen size.</li><li><strong>Mobile-First Design</strong>: Start by designing for smaller screens, then scale up for larger ones.</li></ul><pre>/* Mobile-first approach */<br>.container {<br>  display: flex;<br>  flex-direction: column;<br>}</pre><pre>@media (min-width: 768px) {<br>  .container {<br>    flex-direction: row;<br>  }<br>}</pre><h3>6. Next Steps: Enhancing Your Web Development Skills</h3><p>Once you’re comfortable with HTML, CSS, and JavaScript, the next step is to dive deeper into modern frameworks, libraries, and tools that make web development faster and more efficient. Technologies like React, Angular, TypeScript, and modern CSS frameworks like Tailwind CSS will enhance your ability to build dynamic, scalable applications.</p><h3>Conclusion</h3><p>Mastering the fundamentals of web development is the first step in your journey to becoming a skilled developer. By understanding HTML, CSS, and JavaScript, along with modern development practices and responsive design techniques, you’ll be well-equipped to build professional websites and web applications.</p><p>Here are some fantastic resources to help you get started and deepen your understanding of the fundamentals of web development:</p><h4>HTML &amp; CSS:</h4><p>1. <a href="https://developer.mozilla.org/en-US/docs/Web/HTML">MDN Web Docs — HTML</a>: Comprehensive documentation for HTML with examples and guides to help you understand every element.<br> <br>2. <a href="https://developer.mozilla.org/en-US/docs/Web/CSS">MDN Web Docs — CSS</a>: The go-to resource for learning CSS, from basic syntax to advanced layout techniques like Flexbox and Grid.</p><p>3. <a href="https://learnlayout.com/">Learn CSS Layout</a>: A simple and intuitive guide for learning CSS layout techniques, including Flexbox and Grid.</p><p>4. <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">CSS Tricks — A Complete Guide to Flexbox</a>: An excellent resource for learning Flexbox with practical examples and explanations.</p><h4>JavaScript:</h4><p>1. <a href="https://javascript.info/">JavaScript.info</a>: A comprehensive and beginner-friendly guide to JavaScript, covering everything from the basics to advanced concepts.<br> <br>2. <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript">MDN Web Docs — JavaScript</a>: The official and most detailed reference for JavaScript, perfect for learning how to interact with the DOM and handle events.</p><p>3. <a href="https://eloquentjavascript.net/">Eloquent JavaScript (Book)</a>: A free online book that provides an excellent introduction to JavaScript and programming in general, with interactive examples.</p><h4>Responsive Web Design:</h4><p>1. <a href="https://www.freecodecamp.org/learn/responsive-web-design/">Responsive Web Design — FreeCodeCamp</a>: A free interactive course that teaches HTML, CSS, and responsive design techniques through projects and hands-on challenges.</p><p>2. <a href="https://css-tricks.com/snippets/css/complete-guide-grid/">A Complete Guide to Grid</a>: A helpful resource to master CSS Grid layout, which is essential for creating complex and responsive designs.</p><p>3. <a href="https://www.theodinproject.com/paths/full-stack-javascript/courses/html-and-css">The Odin Project — HTML &amp; CSS</a>: A full curriculum that covers not only the basics of HTML and CSS but also how to build responsive and accessible websites.</p><h4>Modern Development Practices:</h4><p>1. <a href="https://github.com/getify/You-Dont-Know-JS">You Don’t Know JS (Book Series)</a>: An in-depth book series that explores JavaScript and its quirks, helping you to become a better JavaScript developer.</p><p>2. <a href="https://tailwindcss.com/docs">Tailwind CSS Documentation</a>: Tailwind CSS is a utility-first CSS framework. It’s a great tool for modern responsive design and rapid UI development.</p><p>3. <a href="https://www.frontendmentor.io/">Frontend Mentor</a>: This platform provides real-world projects for you to practice your HTML, CSS, and JavaScript skills, with community feedback.</p><p>General Learning Platforms:<br>1. <a href="https://www.freecodecamp.org/">FreeCodeCamp</a>: Offers free and interactive coding challenges and projects for mastering web development, starting from the basics.</p><p>2. <a href="https://www.codecademy.com/learn/paths/web-development">Codecademy — Web Development</a>: A structured learning path that covers everything from HTML, CSS, and JavaScript to more advanced web technologies.</p><p>3. <a href="https://www.coursera.org/specializations/web-design">Coursera — Web Design for Everybody</a>: A comprehensive course series offered by the University of Michigan, covering web design and development from the ground up.</p><p>These resources should help you get up to speed quickly and deepen your understanding as you continue your web development journey. Whether you’re just getting started or looking to refine your skills, each of these will provide valuable insights and hands-on experience!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7177073d22c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why You Can’t Use async Functions Directly in useEffect and How to Handle Asynchronous Side Effects…]]></title>
            <link>https://medium.com/@almustarik/why-you-cant-use-async-functions-directly-in-useeffect-and-how-to-handle-asynchronous-side-effects-fbf529242e49?source=rss-e6e8a90bfac2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbf529242e49</guid>
            <dc:creator><![CDATA[Al Mustarik]]></dc:creator>
            <pubDate>Wed, 22 May 2024 11:54:38 GMT</pubDate>
            <atom:updated>2024-05-22T11:54:38.135Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Why You Can’t Use </strong><strong>async Functions Directly in </strong><strong>useEffect and How to Handle Asynchronous Side Effects in React</strong></h3><p>When working with React, the useEffect hook is an essential tool for managing side effects such as data fetching, subscriptions, or manually manipulating the DOM. If you&#39;ve ever tried to pass an async function directly to useEffect, you might have encountered the following error:</p><pre>Argument of type &#39;() =&gt; Promise&lt;void&gt;&#39; is not assignable to parameter of type &#39;EffectCallback&#39;.<br>Type &#39;Promise&lt;void&gt;&#39; is not assignable to type &#39;void | Destructor&#39;.</pre><p>This error can be confusing at first glance. In this article, we will explore why useEffect does not accept async functions directly, the underlying reasons for this behavior, and the correct pattern for handling asynchronous operations within useEffect.</p><p><strong>Understanding </strong><strong>useEffect</strong></p><p>The useEffect hook is used to perform side effects in functional components. The basic signature of useEffect is:</p><pre>useEffect(effect: () =&gt; (void | (() =&gt; void | undefined)), deps?: DependencyList): void;</pre><p>The function passed to useEffect serves two main purposes:</p><ol><li><strong>Effect Execution:</strong> This function runs after the render phase, allowing you to perform side effects.</li><li><strong>Cleanup:</strong> If the effect requires cleanup (e.g., removing event listeners), the function should return a cleanup function that React will call before the component unmounts or before re-running the effect due to dependency changes.</li></ol><p><strong>Asynchronous Functions and Promises</strong></p><p>When you declare a function with the async keyword, it always returns a Promise. Here’s a simple example:</p><pre>async function asyncFunction() {<br>  // some async operation<br>}<br>// asyncFunction() returns a Promise&lt;void&gt;</pre><p>This transformation occurs because async/await is built on Promises in JavaScript. Even if an async function does not explicitly return a value, it implicitly returns a Promise.</p><p><strong>Why </strong><strong>useEffect Can&#39;t Accept </strong><strong>async Functions Directly</strong></p><p>React’s useEffect does not accept async functions because an async function always returns a Promise, which is not compatible with the expected return type of void or a cleanup function. Here are the main reasons:</p><ol><li><strong>Inconsistent Return Types:</strong> React expects the function passed to useEffect to return either void or a cleanup function. An async function, however, returns a Promise. This inconsistency can lead to errors in React’s lifecycle management.</li><li><strong>Synchronous Cleanup:</strong> Cleanup functions need to be synchronous to ensure they run at the correct time — immediately before the next effect runs or the component unmounts. If React were to accept an async function, the cleanup process might be deferred, leading to unpredictable behavior and potential memory leaks.</li></ol><p><strong>Proper Pattern for Asynchronous Side Effects</strong></p><p>To handle asynchronous operations within useEffect, you should define an async function inside the useEffect callback and then call it. This ensures the useEffect callback remains synchronous and adheres to the expected return type. Here’s the correct pattern:</p><pre>import React, { useEffect } from &#39;react&#39;;<br><br>const MyComponent = () =&gt; {<br>  useEffect(() =&gt; {<br>    const fetchData = async () =&gt; {<br>      try {<br>        const response = await fetch(&#39;https://api.example.com/data&#39;);<br>        const data = await response.json();<br>        // Update state or perform other actions with the data<br>      } catch (error) {<br>        console.error(&#39;Error fetching data:&#39;, error);<br>      }<br>    };<br><br>    fetchData();<br><br>    // Optional: Return a cleanup function if needed<br>    return () =&gt; {<br>      // Cleanup logic here<br>    };<br>  }, []); // dependencies array<br><br>  return &lt;div&gt;My Component&lt;/div&gt;;<br>};<br><br>export default MyComponent;</pre><p><strong>Summary</strong></p><ul><li><strong>Expected Return Type:</strong> useEffect expects a synchronous function that returns void or a cleanup function.</li><li><strong>async Functions:</strong> They return a Promise, which is not compatible with useEffect’s expected return type.</li><li><strong>Cleanup Needs:</strong> Cleanup functions must be synchronous to ensure timely execution.</li></ul><p>By structuring your useEffect callback to define and call an async function within it, you maintain the correct return type and ensure React can manage side effects and their cleanup properly. This approach keeps your asynchronous logic encapsulated within the effect while adhering to React’s lifecycle management requirements.</p><p>Using this pattern, you can effectively manage asynchronous operations in your React components, ensuring both correct functionality and adherence to best practices.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbf529242e49" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>