<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: John Au-Yeung</title>
    <description>The latest articles on DEV Community by John Au-Yeung (@aumayeung).</description>
    <link>https://dev.to/aumayeung</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F302439%2F26242d08-e738-4741-bde5-2ec03569764c.jpg</url>
      <title>DEV Community: John Au-Yeung</title>
      <link>https://dev.to/aumayeung</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aumayeung"/>
    <language>en</language>
    <item>
      <title>Exploring React UI Libraries</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Thu, 05 Jun 2025 00:59:06 +0000</pubDate>
      <link>https://dev.to/aumayeung/exploring-react-ui-libraries-2ino</link>
      <guid>https://dev.to/aumayeung/exploring-react-ui-libraries-2ino</guid>
      <description>&lt;p&gt;React gives you the flexibility to build UIs however you want—but with that flexibility comes a big question: which UI library should you use? There are tons out there, each with different philosophies, features, and trade-offs. &lt;/p&gt;

&lt;p&gt;Some are full design systems. Others are just solid sets of base components. &lt;/p&gt;

&lt;p&gt;Picking the right one can depend on what kind of app you're building, how much customization you need, or just what feels right to code with.&lt;/p&gt;

&lt;p&gt;Let’s dive into a few of the most popular React UI libraries and show off one or two standout features for each—with actual code so you can get a taste of what using them feels like.&lt;/p&gt;

&lt;h1&gt;
  
  
  MUI
&lt;/h1&gt;

&lt;p&gt;Starting with &lt;strong&gt;MUI&lt;/strong&gt;—formerly known as Material-UI—it’s one of the most full-featured libraries available. &lt;/p&gt;

&lt;p&gt;You get a deep component set, strong accessibility support, and Google’s Material Design baked in. One of the first things developers love is how fast you can get a sleek layout together.&lt;/p&gt;

&lt;p&gt;Here’s a simple MUI form with a button:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;TextField&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Container&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@mui/material&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;LoginForm&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Container&lt;/span&gt; &lt;span class="na"&gt;maxWidth&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"sm"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;TextField&lt;/span&gt; &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Email"&lt;/span&gt; &lt;span class="na"&gt;fullWidth&lt;/span&gt; &lt;span class="na"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"normal"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;TextField&lt;/span&gt; &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Password"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="na"&gt;fullWidth&lt;/span&gt; &lt;span class="na"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"normal"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt; &lt;span class="na"&gt;variant&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"contained"&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"primary"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Login&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything looks good out of the box. You barely need to write custom styles. If you want to tweak things, the theme system gives you deep control—but you can ignore it if you just want to move fast.&lt;/p&gt;

&lt;h1&gt;
  
  
  Chakra UI
&lt;/h1&gt;

&lt;p&gt;Now jump over to &lt;strong&gt;Chakra UI&lt;/strong&gt;, which has a different vibe. It emphasizes simplicity and composability using “style props.” &lt;/p&gt;

&lt;p&gt;You can apply spacing, colors, and layout just by passing props—no CSS file or styled-components needed. &lt;/p&gt;

&lt;p&gt;And everything is accessible by default.&lt;/p&gt;

&lt;p&gt;Here’s the same kind of form using Chakra:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Box&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Stack&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@chakra-ui/react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;LoginForm&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Box&lt;/span&gt; &lt;span class="na"&gt;maxW&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"sm"&lt;/span&gt; &lt;span class="na"&gt;mx&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"auto"&lt;/span&gt; &lt;span class="na"&gt;mt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Stack&lt;/span&gt; &lt;span class="na"&gt;spacing&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Input&lt;/span&gt; &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Email"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Input&lt;/span&gt; &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Password"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt; &lt;span class="na"&gt;colorScheme&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"teal"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Login&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Stack&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Box&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s concise and readable, and you get responsive, accessible components with almost no boilerplate. &lt;/p&gt;

&lt;p&gt;Chakra also makes theming feel natural. If you’re building something modern and lightweight, it’s a great experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  Tailwind  and Headless UI
&lt;/h1&gt;

&lt;p&gt;While we’re talking about styling and control, let’s bring in &lt;strong&gt;Tailwind CSS&lt;/strong&gt;—and more specifically, &lt;strong&gt;Headless UI&lt;/strong&gt;, which is made to pair with it. &lt;/p&gt;

&lt;p&gt;Headless UI gives you functional components without styling, but with full accessibility.&lt;/p&gt;

&lt;p&gt;For example, here’s how a dropdown menu looks using Headless UI and Tailwind:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Menu&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@headlessui/react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Dropdown&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Menu&lt;/span&gt; &lt;span class="na"&gt;as&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"div"&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"relative inline-block text-left"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Menu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"px-4 py-2 bg-blue-600 text-white rounded"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Options&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Menu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Menu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Items&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"absolute mt-2 w-48 bg-white border rounded shadow-lg"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Menu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;active&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;active&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bg-blue-100&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; w-full px-4 py-2 text-left`&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
              Profile
            &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Menu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Menu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Items&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Menu&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You control all the styling with Tailwind, but you don’t have to write any of the keyboard or ARIA logic. &lt;/p&gt;

&lt;p&gt;That’s a big win if you like to design your own look but still want accessibility to be handled well.&lt;/p&gt;

&lt;p&gt;Now, let’s talk about &lt;strong&gt;Ant Design&lt;/strong&gt;, or AntD. It’s widely used in enterprise apps and internal dashboards. It gives you advanced components out of the box, including things like tables with filtering and pagination, or date pickers with locale support.&lt;/p&gt;

&lt;p&gt;Here’s how fast you can build a data table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Table&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;antd&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John Doe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;john@example.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Jane Smith&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;jane@example.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;columns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;dataIndex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Age&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;dataIndex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;age&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Email&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;dataIndex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;email&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;UserTable&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Table&lt;/span&gt; &lt;span class="na"&gt;dataSource&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;columns&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it. You get sorting, styling, and responsiveness with barely any code. AntD leans opinionated, so it shines when you want consistency and don't need to heavily restyle every component.&lt;/p&gt;

&lt;h1&gt;
  
  
  React Bootstrap
&lt;/h1&gt;

&lt;p&gt;Then there’s &lt;strong&gt;React Bootstrap&lt;/strong&gt;, which brings the classic Bootstrap framework into the React world. If you’ve used Bootstrap in the past, it’ll feel familiar. &lt;/p&gt;

&lt;p&gt;It’s not trendy, but it’s steady and well-documented.&lt;/p&gt;

&lt;p&gt;Here’s a simple layout using React Bootstrap:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Container&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-bootstrap&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ContactForm&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Group&lt;/span&gt; &lt;span class="na"&gt;controlId&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"formName"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Name&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Control&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Enter your name"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Group&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Group&lt;/span&gt; &lt;span class="na"&gt;controlId&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"formMessage"&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mt-3"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Message&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Control&lt;/span&gt; &lt;span class="na"&gt;as&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"textarea"&lt;/span&gt; &lt;span class="na"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Group&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mt-3"&lt;/span&gt; &lt;span class="na"&gt;variant&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"primary"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          Send
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s simple and structured. If your team is used to Bootstrap, or you're maintaining an older UI with new React features, React Bootstrap is an easy win.&lt;/p&gt;

&lt;h1&gt;
  
  
  Mantine
&lt;/h1&gt;

&lt;p&gt;Now for a slightly newer contender: &lt;strong&gt;Mantine&lt;/strong&gt;. It’s modern, modular, and offers both components and custom hooks. &lt;/p&gt;

&lt;p&gt;You get thoughtful defaults, dark mode support, and nice utility features like modals and notifications built right in.&lt;/p&gt;

&lt;p&gt;Let’s check out a color picker with Mantine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ColorInput&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@mantine/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ThemeSettings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ColorInput&lt;/span&gt; &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Pick a primary color"&lt;/span&gt; &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"#ffffff"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or a notification, which is shockingly simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;showNotification&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@mantine/notifications&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;showNotification&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Success!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Your form was submitted&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;green&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These kinds of helpers make Mantine feel like it’s thinking ahead for you. &lt;br&gt;
It’s gaining popularity quickly, especially for teams that want built-in solutions without sacrificing customizability.&lt;/p&gt;

&lt;p&gt;And finally, if you want to go as low-level as possible while still avoiding accessibility pitfalls, look at &lt;strong&gt;Radix UI&lt;/strong&gt;. Radix provides primitive components—like popovers, sliders, or tabs—but leaves all the styling to you.&lt;/p&gt;

&lt;p&gt;Here’s a simple example of a popover:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Popover&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@radix-ui/react-popover&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;HelpPopover&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Popover&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Root&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Popover&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Trigger&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bg-gray-200 p-2 rounded"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;?&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Popover&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Trigger&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Popover&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bg-white border p-4 rounded shadow-md"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Here's some helpful info.
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Popover&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Popover&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Root&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It handles positioning, focus trapping, accessibility—but not styles. &lt;/p&gt;

&lt;p&gt;It's perfect if you want to bring your own design system but still want accessibility and usability covered.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Each of these libraries shines in its own way. MUI gives you polish and structure. &lt;/p&gt;

&lt;p&gt;Chakra offers intuitive styling. Headless UI and Radix give you raw power and accessibility. &lt;/p&gt;

&lt;p&gt;AntD is great for enterprise needs. React Bootstrap offers legacy familiarity. Mantine brings convenience and elegance.&lt;/p&gt;

&lt;p&gt;There’s no universal answer. It’s about matching the library to your needs—how much freedom you want, how much you want to customize, and what kind of project you’re building.&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>A Practical Guide to Prettier</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Thu, 05 Jun 2025 00:52:05 +0000</pubDate>
      <link>https://dev.to/aumayeung/a-practical-guide-to-prettier-2bl3</link>
      <guid>https://dev.to/aumayeung/a-practical-guide-to-prettier-2bl3</guid>
      <description>&lt;p&gt;If you've spent any time working with JavaScript, you know how quickly formatting differences can spiral out of control. One person uses double quotes, someone else prefers single; some files end in semicolons, others don’t; indentation seems to shift with the wind. Before long, you’re spending more time on formatting debates than on actual development. &lt;/p&gt;

&lt;p&gt;This is where Prettier comes in—and it’s a game changer.&lt;/p&gt;

&lt;p&gt;Prettier is an opinionated code formatter that takes the burden of formatting off your plate. It parses your JavaScript and rewrites it with consistent style rules—rules that are enforced uniformly across every file. &lt;/p&gt;

&lt;p&gt;It doesn’t ask for your opinion; it just gets the job done. At first, that can feel restrictive. But the longer you use it, the more you appreciate that consistency. &lt;/p&gt;

&lt;p&gt;Prettier doesn’t just clean up your code; it reduces friction in your workflow and in your team.&lt;/p&gt;

&lt;p&gt;Let’s walk through how you can get Prettier up and running in a JavaScript project.&lt;/p&gt;

&lt;p&gt;First, make sure you have Node.js installed. Once that’s ready, open your terminal, navigate to your project folder, and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This initializes a &lt;code&gt;package.json&lt;/code&gt; file if you don’t already have one. Then, install Prettier as a development dependency:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; prettier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once that’s done, you can run Prettier directly from the command line using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx prettier &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will format all compatible files in your current directory. But usually, you'll want to configure it to suit your preferences a bit. While Prettier doesn’t allow deep customization (by design), it does let you tweak a few options like line width, tabs vs. spaces, and quote style.&lt;/p&gt;

&lt;p&gt;Create a configuration file in your project root. You can use &lt;code&gt;.prettierrc&lt;/code&gt;, and inside that file, add something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"semi"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"singleQuote"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tabWidth"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"trailingComma"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"es5"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Prettier to use semicolons, single quotes, 2-space tabs, and trailing commas where valid in ES5.&lt;/p&gt;

&lt;p&gt;You can also create a &lt;code&gt;.prettierignore&lt;/code&gt; file—similar to &lt;code&gt;.gitignore&lt;/code&gt;—to exclude certain files or folders from formatting. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules
dist
build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, for a smoother experience, especially during development, it’s worth integrating Prettier with your code editor. If you’re using Visual Studio Code, search for the "Prettier – Code formatter" extension in the Extensions tab and install it. Once installed, open your VS Code settings and enable “Format on Save.” This way, every time you save a file, Prettier will auto-format it in the background.&lt;/p&gt;

&lt;p&gt;Next, consider adding a formatting script to your &lt;code&gt;package.json&lt;/code&gt; so anyone working on your project can quickly run Prettier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"format"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"prettier --write ."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you can run &lt;code&gt;npm run format&lt;/code&gt; to format the entire codebase. This is especially helpful before committing changes or merging branches.&lt;/p&gt;

&lt;p&gt;If you’re working on a team or planning to contribute to open source, you can go a step further by integrating Prettier into your version control process. Tools like Husky and lint-staged let you run Prettier on staged files before every commit. That way, no code enters the repository without being cleaned up first.&lt;/p&gt;

&lt;p&gt;To do this, first install Husky and lint-staged:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; husky lint-staged
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, add the following to your &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"husky"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"pre-commit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"lint-staged"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"lint-staged"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"*.js"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"prettier --write"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This setup will automatically format JavaScript files when you commit them, helping you and your team maintain a clean, consistent codebase with very little overhead.&lt;/p&gt;

&lt;p&gt;Once Prettier is part of your project, using it becomes second nature. You stop worrying about indentation or bracket placement and just write code. Prettier handles the polish.&lt;/p&gt;

&lt;p&gt;It’s easy to underestimate how much mental clutter formatting decisions create until it’s gone. Prettier clears that clutter. And not just for individuals—it simplifies collaboration, speeds up code reviews, and helps onboard new developers faster. Instead of guessing how code &lt;em&gt;should&lt;/em&gt; look, everyone follows the same rules, enforced by the same tool, automatically.&lt;/p&gt;

&lt;p&gt;Yes, Prettier is opinionated. And sure, it might clash with your preferences now and then. But what it gives you in return—consistency, clarity, and peace of mind—is more than worth it. &lt;/p&gt;

&lt;p&gt;Most developers who try it end up sticking with it, not because they lose control, but because they gain focus.&lt;/p&gt;

&lt;p&gt;So if you haven’t tried Prettier yet, now’s a perfect time. Add it to a small project. &lt;/p&gt;

&lt;p&gt;Let it reformat your scripts. Watch how it cleans things up. It won’t take long before you start wondering how you ever coded without it.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>The Best ESLint Rules for Clean and Consistent JavaScript Code</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Thu, 05 Jun 2025 00:49:00 +0000</pubDate>
      <link>https://dev.to/aumayeung/the-best-eslint-rules-for-clean-and-consistent-javascript-code-308o</link>
      <guid>https://dev.to/aumayeung/the-best-eslint-rules-for-clean-and-consistent-javascript-code-308o</guid>
      <description>&lt;p&gt;ESLint has become a crucial part of modern JavaScript development. It helps maintain code quality, consistency, and readability by enforcing specific rules. &lt;/p&gt;

&lt;p&gt;The tool acts like a virtual pair of eyes that examines your code for patterns that may lead to errors or suboptimal practices. With thousands of possible rules available, developers often struggle to choose the most beneficial ones. &lt;/p&gt;

&lt;p&gt;In this article we explore some of the best ESLint rules that strike a balance between rigor and flexibility—without overwhelming you.&lt;/p&gt;

&lt;h1&gt;
  
  
  no-unused-vars
&lt;/h1&gt;

&lt;p&gt;One of the first and most helpful rules to consider is &lt;code&gt;no-unused-vars&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;This rule prevents the declaration of variables that are never used. While it may seem harmless to leave a variable lying around, it can signal unfinished logic or unnecessary clutter in your codebase. &lt;/p&gt;

&lt;p&gt;It also leads to cognitive overhead for other developers trying to understand why a variable exists.&lt;/p&gt;

&lt;h1&gt;
  
  
  eqeqeq
&lt;/h1&gt;

&lt;p&gt;Another critical rule is &lt;code&gt;eqeqeq&lt;/code&gt;, which enforces the use of strict equality operators (&lt;code&gt;===&lt;/code&gt; and &lt;code&gt;!==&lt;/code&gt;) instead of their loose counterparts (&lt;code&gt;==&lt;/code&gt; and &lt;code&gt;!=&lt;/code&gt;). &lt;/p&gt;

&lt;p&gt;Loose equality can lead to unexpected type coercions, which often cause bugs that are hard to trace. &lt;/p&gt;

&lt;p&gt;By enforcing strict equality, your code becomes more predictable and less prone to subtle errors.&lt;/p&gt;

&lt;h1&gt;
  
  
  no-console
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;no-console&lt;/code&gt; rule is often debated. In production code, it makes sense to disallow &lt;code&gt;console.log()&lt;/code&gt; statements because they clutter the output and can leak sensitive information. &lt;/p&gt;

&lt;p&gt;In development environments, this rule can be relaxed, but it’s still wise to flag them so they don’t end up in final builds unnoticed.&lt;/p&gt;

&lt;h1&gt;
  
  
  no-magic-numbers
&lt;/h1&gt;

&lt;p&gt;One particularly helpful rule for readability is &lt;code&gt;no-magic-numbers&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Magic numbers are numeric literals that appear in your code without explanation, such as &lt;code&gt;if (score &amp;gt; 42)&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;This rule encourages the use of named constants, which make your code self-documenting and easier to update later. Instead of &lt;code&gt;42&lt;/code&gt;, defining a constant like &lt;code&gt;const PASSING_SCORE = 42&lt;/code&gt; instantly makes your intent clearer.&lt;/p&gt;

&lt;h1&gt;
  
  
  indent
&lt;/h1&gt;

&lt;p&gt;Consistency in formatting can make or break the maintainability of a codebase. &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;indent&lt;/code&gt; rule enforces consistent indentation. Whether your team prefers two or four spaces, having the rule in place ensures everyone follows the same structure, preventing merge conflicts and visual confusion.&lt;/p&gt;

&lt;h1&gt;
  
  
  semi
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;semi&lt;/code&gt; rule is another formatting-related setting that dictates whether semicolons are required at the end of statements. &lt;/p&gt;

&lt;p&gt;While JavaScript allows you to omit them in many cases, enforcing a consistent semicolon policy can prevent bugs related to automatic semicolon insertion, which can behave unpredictably in some scenarios.&lt;/p&gt;

&lt;h1&gt;
  
  
  prefer-const
&lt;/h1&gt;

&lt;p&gt;For developers working with modern JavaScript, the &lt;code&gt;prefer-const&lt;/code&gt; rule is incredibly useful. &lt;/p&gt;

&lt;p&gt;It suggests using &lt;code&gt;const&lt;/code&gt; instead of &lt;code&gt;let&lt;/code&gt; for variables that are never reassigned. This helps convey intent clearly and minimizes the risk of accidental reassignment, which can lead to hard-to-find bugs.&lt;/p&gt;

&lt;h1&gt;
  
  
  no-var
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;no-var&lt;/code&gt; rule promotes the use of &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; over &lt;code&gt;var&lt;/code&gt;. With the advent of ES6, &lt;code&gt;var&lt;/code&gt; has become largely obsolete due to its function-scoping behavior, which often leads to confusing results. &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are block-scoped and offer more predictable behavior, making your code easier to reason about.&lt;/p&gt;

&lt;h1&gt;
  
  
  no-param-reassign
&lt;/h1&gt;

&lt;p&gt;A rule that emphasizes best practices in function handling is &lt;code&gt;no-param-reassign&lt;/code&gt;. This rule prevents you from reassigning function parameters. &lt;/p&gt;

&lt;p&gt;While it might seem convenient to modify parameters directly, doing so often leads to unexpected behavior, especially in asynchronous code or closures. &lt;/p&gt;

&lt;p&gt;Copying the parameter to a new variable before changing it is generally the safer route.&lt;/p&gt;

&lt;h1&gt;
  
  
  curly
&lt;/h1&gt;

&lt;p&gt;If you care about the clarity and structure of your code blocks, the &lt;code&gt;curly&lt;/code&gt; rule is worth enabling. It enforces the use of curly braces for all control statements, even if they contain only a single line. &lt;/p&gt;

&lt;p&gt;This might seem excessive, but it helps avoid bugs that occur when additional statements are added later and braces are forgotten.&lt;/p&gt;

&lt;h1&gt;
  
  
  arrow-body-style
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;arrow-body-style&lt;/code&gt; rule encourages concise arrow functions when possible. &lt;/p&gt;

&lt;p&gt;For example, instead of writing &lt;code&gt;const add = (a, b) =&amp;gt; { return a + b; }&lt;/code&gt;, it suggests simplifying it to &lt;code&gt;const add = (a, b) =&amp;gt; a + b;&lt;/code&gt;. This results in more succinct code that’s easier to scan and understand.&lt;/p&gt;

&lt;h1&gt;
  
  
  object-curly-spacing
&lt;/h1&gt;

&lt;p&gt;Another rule that promotes better readability and maintainability is &lt;code&gt;object-curly-spacing&lt;/code&gt;. This rule enforces consistent spacing inside curly braces of object literals and destructuring assignments. &lt;/p&gt;

&lt;p&gt;Whether you choose &lt;code&gt;{ foo: bar }&lt;/code&gt; or &lt;code&gt;{foo: bar}&lt;/code&gt;, what matters is consistency throughout the codebase.&lt;/p&gt;

&lt;h1&gt;
  
  
  comma-dangle
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;comma-dangle&lt;/code&gt; rule might seem like a nitpick, but it has practical implications. It enforces or disallows trailing commas in object and array literals. &lt;/p&gt;

&lt;p&gt;When enabled to require trailing commas, it makes diffs cleaner in version control and simplifies the process of adding new elements to these structures.&lt;/p&gt;

&lt;h1&gt;
  
  
  quotes
&lt;/h1&gt;

&lt;p&gt;Among stylistic preferences, &lt;code&gt;quotes&lt;/code&gt; is a useful rule for enforcing consistency in the use of single or double quotes. Again, the main value here is in uniformity, which reduces distractions and keeps the focus on what the code does rather than how it’s styled.&lt;/p&gt;

&lt;h1&gt;
  
  
  no-shadow
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;no-shadow&lt;/code&gt; rule prevents variable declarations from shadowing variables declared in the outer scope. &lt;/p&gt;

&lt;p&gt;Shadowing can make it extremely difficult to track which variable is being referenced, especially in larger functions or nested scopes. &lt;/p&gt;

&lt;p&gt;Avoiding it reduces bugs and makes your code easier to debug.&lt;/p&gt;

&lt;p&gt;A strong rule for clarity is &lt;code&gt;consistent-return&lt;/code&gt;, which enforces that every code path in a function either returns a value or doesn’t return at all. &lt;/p&gt;

&lt;p&gt;This prevents scenarios where some branches return a result and others return undefined, leading to inconsistent outcomes that can break your program.&lt;/p&gt;

&lt;h1&gt;
  
  
  default-case
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;default-case&lt;/code&gt; rule ensures that &lt;code&gt;switch&lt;/code&gt; statements have a &lt;code&gt;default&lt;/code&gt; branch. &lt;/p&gt;

&lt;p&gt;Even if you think you've handled every case, the default ensures your code behaves predictably if an unexpected value shows up. This is especially useful when dealing with external data or user inputs.&lt;/p&gt;

&lt;h1&gt;
  
  
  no-async-promise-executor
&lt;/h1&gt;

&lt;p&gt;For async programming, the &lt;code&gt;no-async-promise-executor&lt;/code&gt; rule is essential. &lt;/p&gt;

&lt;p&gt;It disallows using &lt;code&gt;async&lt;/code&gt; functions as Promise executors, which can cause unhandled rejections or misinterpreted promise behavior. &lt;/p&gt;

&lt;p&gt;This rule protects developers from common pitfalls when working with asynchronous logic.&lt;/p&gt;

&lt;h1&gt;
  
  
  yoda
&lt;/h1&gt;

&lt;p&gt;Finally, the &lt;code&gt;yoda&lt;/code&gt; rule governs the style of conditional expressions, specifically the order of literals and variables. &lt;/p&gt;

&lt;p&gt;While often a matter of preference, enforcing one approach across the codebase—typically placing variables on the left—improves code scanning and reduces cognitive overhead.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Each of these ESLint rules contributes something valuable to your codebase. &lt;/p&gt;

&lt;p&gt;Together, they help enforce consistency, prevent subtle bugs, and promote best practices. &lt;/p&gt;

&lt;p&gt;The key is not to enforce every rule but to choose the ones that align with your team's style and goals. &lt;/p&gt;

&lt;p&gt;ESLint allows for fine-tuning, meaning you can warn, error, or turn off rules depending on the context.&lt;/p&gt;

&lt;p&gt;Using ESLint effectively isn’t just about catching mistakes, it’s about codifying your development standards so that every contributor can write code that feels cohesive, clean, and professional.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>eslint</category>
    </item>
    <item>
      <title>Automating JavaScript Security Testing</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Thu, 05 Jun 2025 00:42:40 +0000</pubDate>
      <link>https://dev.to/aumayeung/automating-javascript-security-testing-5b07</link>
      <guid>https://dev.to/aumayeung/automating-javascript-security-testing-5b07</guid>
      <description>&lt;p&gt;In the fast-paced world of web development, security can’t be an afterthought. &lt;/p&gt;

&lt;p&gt;While best practices like input validation and avoiding dangerous APIs are essential, they only go so far without regular and automated security testing. &lt;/p&gt;

&lt;p&gt;Fortunately, there’s a growing ecosystem of tools designed to help JavaScript developers detect vulnerabilities early—before they ship code.&lt;/p&gt;

&lt;p&gt;In this article, we’ll walk through some of the best tools for automating JavaScript security testing and provide guidance on how to secure two of the most widely used JavaScript frameworks: &lt;strong&gt;React&lt;/strong&gt; and &lt;strong&gt;Angular&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Automated Security Testing Matters
&lt;/h2&gt;

&lt;p&gt;Manual code reviews are important, but not scalable or foolproof. Automated security testing tools identify known vulnerabilities in dependencies.&lt;/p&gt;

&lt;p&gt;They detect risky coding patterns and insecure practices.&lt;/p&gt;

&lt;p&gt;They integrate into CI/CD pipelines to catch issues before production.&lt;/p&gt;

&lt;p&gt;And they can continuously scan for new threats** even after deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  npm audit
&lt;/h2&gt;

&lt;p&gt;Every project using Node.js and npm already has access to &lt;code&gt;npm audit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It scans your project’s &lt;code&gt;package-lock.json&lt;/code&gt; file for known vulnerabilities.&lt;/p&gt;

&lt;p&gt;It Uses the GitHub Advisory Database and other sources. And it suggests fixes or updated versions for vulnerable packages.&lt;/p&gt;

&lt;p&gt;To use it we run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm audit
npm audit fix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's ideal for any Node.js-based JavaScript project like React, Vue, Angular apps using npm.&lt;/p&gt;




&lt;h2&gt;
  
  
  Snyk
&lt;/h2&gt;

&lt;p&gt;Snyk is a powerful security tool that scans open-source dependencies and container images.&lt;/p&gt;

&lt;p&gt;It scans for vulnerabilities in &lt;code&gt;package.json&lt;/code&gt;, Dockerfiles, and GitHub repos.&lt;/p&gt;

&lt;p&gt;Snyk can alert for license issues and high-severity flaws.&lt;/p&gt;

&lt;p&gt;And it integrates with GitHub, GitLab, Bitbucket, and CI/CD tools like Jenkins and CircleCI.&lt;/p&gt;

&lt;p&gt;It has a free tier available for small teams. And integrates with GitHub to auto-scan every pull request.&lt;/p&gt;

&lt;p&gt;Teams managing complex dependency trees or using microservices can use this to scan for any security issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  ESLint Security Rules
&lt;/h2&gt;

&lt;p&gt;ESLint is widely used for code quality, but it can also help with security.&lt;/p&gt;

&lt;p&gt;We can usee plugins like &lt;a href="https://www.npmjs.com/package/eslint-plugin-security" rel="noopener noreferrer"&gt;&lt;code&gt;eslint-plugin-security&lt;/code&gt;&lt;/a&gt; to detect potentially dangerous patterns (e.g., use of &lt;code&gt;eval()&lt;/code&gt; or insecure regex).&lt;/p&gt;

&lt;p&gt;To use it we run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;eslint-plugin-security &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add it to your &lt;code&gt;.eslintrc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"plugins"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"security"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"extends"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"plugin:security/recommended"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's suitable for projects where linting is already in place. And catching mistakes during development.&lt;/p&gt;




&lt;h2&gt;
  
  
  Retire.js
&lt;/h2&gt;

&lt;p&gt;Retire.js is a specialized tool that scans for known vulnerabilities in JavaScript libraries (client-side and server-side).&lt;/p&gt;

&lt;p&gt;It supports scanning both Node modules and front-end scripts. And it works via CLI, Grunt/Gulp, or browser extension.&lt;/p&gt;

&lt;p&gt;Also it maintains a vulnerability database updated frequently.&lt;/p&gt;

&lt;p&gt;To use it we run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; retire
retire
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's suitable for projects with a mix of frontend and backend JavaScript.&lt;br&gt;
And detecting outdated libraries like jQuery or Bootstrap is easy with this.&lt;/p&gt;


&lt;h2&gt;
  
  
  OWASP ZAP (Zed Attack Proxy)
&lt;/h2&gt;

&lt;p&gt;ZAP is a dynamic security testing tool that simulates real-world attacks on your application.&lt;/p&gt;

&lt;p&gt;It intercepts web traffic and looks for vulnerabilities like XSS and CSRF.&lt;br&gt;
And it offers automation via APIs and CI/CD plugins.&lt;/p&gt;

&lt;p&gt;Also it provides passive and active scanning modes.&lt;/p&gt;

&lt;p&gt;It's good for more advanced teams looking for penetration testing automation And integrates info CI environments for end-to-end testing.&lt;/p&gt;
&lt;h2&gt;
  
  
  Securing React Applications
&lt;/h2&gt;

&lt;p&gt;React is known for its component-based architecture, which adds some natural protection (e.g., auto-escaping outputs), but it still has vulnerabilities if misused.&lt;/p&gt;
&lt;h3&gt;
  
  
  React Security Tips:
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Avoid &lt;code&gt;dangerouslySetInnerHTML&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;React escapes content by default. Using &lt;code&gt;dangerouslySetInnerHTML&lt;/code&gt; bypasses this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// BAD&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;dangerouslySetInnerHTML&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;__html&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead, use libraries like &lt;code&gt;DOMPurify&lt;/code&gt; when rendering HTML.&lt;/p&gt;

&lt;h4&gt;
  
  
  Use ESLint Plugins
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/jsx-eslint/eslint-plugin-jsx-a11y" rel="noopener noreferrer"&gt;&lt;code&gt;eslint-plugin-jsx-a11y&lt;/code&gt;&lt;/a&gt;: Improves accessibility, which contributes to security.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.npmjs.com/package/eslint-plugin-react-security" rel="noopener noreferrer"&gt;&lt;code&gt;eslint-plugin-react-security&lt;/code&gt;&lt;/a&gt;: Adds React-specific security linting rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Secure API Access
&lt;/h4&gt;

&lt;p&gt;We should never hardcode tokens in React code. And it's best to use environment variables securely via a &lt;code&gt;.env&lt;/code&gt; file and proxy calls to a backend.&lt;/p&gt;

&lt;h4&gt;
  
  
  Enable Strict CSP
&lt;/h4&gt;

&lt;p&gt;We can use &lt;code&gt;Helmet&lt;/code&gt; for secure HTTP headers if serving React via Node.js/Express. And also avoid loading scripts from CDNs or third-party domains unless trusted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Securing Angular Applications
&lt;/h2&gt;

&lt;p&gt;Angular is more opinionated than React and includes built-in security mechanisms, but it still requires developer discipline.&lt;/p&gt;

&lt;h3&gt;
  
  
  Angular Security Tips:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Use Angular’s Built-in Sanitization
&lt;/h4&gt;

&lt;p&gt;Angular automatically sanitizes HTML in templates, but explicitly bypassing it is dangerous.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// BAD&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sanitizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bypassSecurityTrustHtml&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userInput&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use only when absolutely necessary, and validate the input string.&lt;/p&gt;

&lt;h4&gt;
  
  
  Avoid InnerHTML Binding
&lt;/h4&gt;

&lt;p&gt;Like React’s &lt;code&gt;dangerouslySetInnerHTML&lt;/code&gt;, Angular’s &lt;code&gt;[innerHTML]&lt;/code&gt; can lead to XSS if misused.&lt;/p&gt;

&lt;h4&gt;
  
  
  Use HTTP Interceptors
&lt;/h4&gt;

&lt;p&gt;For secure API calls, use interceptors to attach tokens and manage headers centrally.&lt;/p&gt;

&lt;h4&gt;
  
  
  Enable Security Headers
&lt;/h4&gt;

&lt;p&gt;We can use Angular Universal with Express to serve Angular apps.&lt;br&gt;
And add security headers with libraries like &lt;code&gt;helmet&lt;/code&gt; or via server configuration.&lt;/p&gt;




&lt;h2&gt;
  
  
  Integrating Security Tools Into CI/CD
&lt;/h2&gt;

&lt;p&gt;For optimal protection, plug these tools directly into your build pipeline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example CI Setup:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;npm audit&lt;/code&gt; or &lt;code&gt;snyk test&lt;/code&gt; on every PR.&lt;/li&gt;
&lt;li&gt;Lint with ESLint + security plugins.&lt;/li&gt;
&lt;li&gt;Use ZAP or similar tools for dynamic scanning on staging builds.&lt;/li&gt;
&lt;li&gt;Monitor your GitHub repo for dependency alerts.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Securing JavaScript applications goes far beyond writing clean code—it requires proactive scanning, framework-specific awareness, and seamless integration into your workflow. &lt;/p&gt;

&lt;p&gt;Tools like Snyk, Retire.js, and ESLint security plugins automate a huge chunk of the process, while frameworks like React and Angular offer built-in safety mechanisms if used correctly.&lt;/p&gt;

&lt;p&gt;By adopting these tools and techniques, you not only reduce the risk of vulnerabilities but also build a development culture where security is baked into every line of code.&lt;/p&gt;

</description>
      <category>security</category>
      <category>javascript</category>
      <category>programming</category>
      <category>react</category>
    </item>
    <item>
      <title>Security Best Practices in JavaScript</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Thu, 05 Jun 2025 00:32:19 +0000</pubDate>
      <link>https://dev.to/aumayeung/security-best-practices-in-javascript-3lan</link>
      <guid>https://dev.to/aumayeung/security-best-practices-in-javascript-3lan</guid>
      <description>&lt;p&gt;JavaScript has become the backbone of modern web applications, enabling rich, interactive experiences across billions of websites worldwide. But with this power comes significant security risks. &lt;/p&gt;

&lt;p&gt;Since JavaScript runs on the client side and often communicates directly with servers, it’s a prime target for attackers seeking to exploit vulnerabilities. &lt;/p&gt;

&lt;p&gt;Ignoring security best practices in JavaScript can lead to data breaches, compromised user accounts, and damaged reputations.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore fundamental security principles and best practices every JavaScript developer should know to build safer, more resilient applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Security Landscape in JavaScript
&lt;/h2&gt;

&lt;p&gt;JavaScript faces unique challenges compared to server-side languages because it executes directly in users’ browsers, making it vulnerable to attacks that target both the client and server. &lt;/p&gt;

&lt;p&gt;Common security threats include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cross-Site Scripting (XSS):&lt;/strong&gt; Malicious scripts injected into web pages, executed in other users’ browsers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-Site Request Forgery (CSRF):&lt;/strong&gt; Unauthorized commands transmitted from a user’s browser without their consent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Insecure Direct Object References:&lt;/strong&gt; Access to data or resources without proper authorization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Injection:&lt;/strong&gt; Execution of unauthorized code due to unsanitized inputs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Knowing these attack vectors is crucial to understanding why certain security practices matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sanitize and Validate Inputs
&lt;/h2&gt;

&lt;p&gt;One of the most basic but critical security rules is to never trust user input. Attackers can manipulate forms, URLs, or APIs to send malicious data that compromises your app.&lt;/p&gt;

&lt;p&gt;Validate all inputs on the server side to ensure they match expected formats and values.&lt;/p&gt;

&lt;p&gt;Remove or encode characters that could be interpreted as executable code—especially in inputs rendered back into HTML.&lt;/p&gt;

&lt;p&gt;And use libraries like DOMPurify to clean HTML inputs safely.&lt;/p&gt;

&lt;p&gt;XSS attacks rely on injecting malicious JavaScript into inputs or URLs that the app then executes. &lt;/p&gt;

&lt;p&gt;Proper validation and sanitization stop harmful code from ever running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Content Security Policy (CSP)
&lt;/h2&gt;

&lt;p&gt;Content Security Policy (CSP) is an HTTP header that instructs browsers which sources of content (scripts, styles, images) are allowed to load.&lt;/p&gt;

&lt;p&gt;Implement a strict CSP to restrict inline JavaScript and loading of scripts from untrusted domains.&lt;/p&gt;

&lt;p&gt;Avoid the use of &lt;code&gt;'unsafe-inline'&lt;/code&gt; and &lt;code&gt;'unsafe-eval'&lt;/code&gt; directives, which undermine CSP effectiveness.&lt;/p&gt;

&lt;p&gt;Report violations using the &lt;code&gt;report-uri&lt;/code&gt; directive to monitor potential attacks.&lt;/p&gt;

&lt;p&gt;CSP is a powerful defense against XSS attacks by limiting where scripts can come from and preventing inline execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Avoid Dangerous APIs
&lt;/h2&gt;

&lt;p&gt;JavaScript provides powerful APIs, but some are more risky when abused.&lt;/p&gt;

&lt;p&gt;We should avoid using &lt;code&gt;eval()&lt;/code&gt;, &lt;code&gt;new Function()&lt;/code&gt;, or similar functions that execute arbitrary code strings.&lt;/p&gt;

&lt;p&gt;Be cautious with &lt;code&gt;innerHTML&lt;/code&gt; or &lt;code&gt;document.write()&lt;/code&gt; which can inject untrusted HTML and scripts.&lt;/p&gt;

&lt;p&gt;And we should use safer alternatives like &lt;code&gt;textContent&lt;/code&gt; or &lt;code&gt;innerText&lt;/code&gt; when inserting user-generated content.&lt;/p&gt;

&lt;p&gt;Because executing strings as code opens up huge attack surfaces, allowing injection of malicious payloads.&lt;/p&gt;




&lt;h2&gt;
  
  
  Secure Cookies and Local Storage
&lt;/h2&gt;

&lt;p&gt;Web applications commonly use cookies and localStorage or sessionStorage to store user information.&lt;/p&gt;

&lt;p&gt;We should use &lt;code&gt;HttpOnly&lt;/code&gt; and &lt;code&gt;Secure&lt;/code&gt; flags on cookies to prevent JavaScript access and ensure transmission over HTTPS.&lt;/p&gt;

&lt;p&gt;And avoid storing sensitive data (like authentication tokens) in localStorage since it’s accessible via JavaScript and vulnerable to XSS.&lt;/p&gt;

&lt;p&gt;We should use short expiration times and refresh tokens frequently.&lt;/p&gt;

&lt;p&gt;If attackers can access tokens or session data, they can impersonate users or hijack sessions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implement Proper Authentication and Authorization
&lt;/h2&gt;

&lt;p&gt;JavaScript apps often interface with backend APIs to authenticate users and access data.&lt;/p&gt;

&lt;p&gt;We should use strong authentication methods like OAuth or JWT (JSON Web Tokens).&lt;/p&gt;

&lt;p&gt;And we should validate all authorization on the server side, never trust client-side checks alone.&lt;/p&gt;

&lt;p&gt;APIs should be protected with rate limiting and monitoring to prevent brute force or abuse.&lt;/p&gt;

&lt;p&gt;This matters because weak or client-only authentication can allow unauthorized access to sensitive information or actions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use HTTPS Everywhere
&lt;/h2&gt;

&lt;p&gt;Serving your JavaScript app over HTTPS is a must.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTPS encrypts data in transit, preventing man-in-the-middle (MITM) attacks.&lt;/li&gt;
&lt;li&gt;Modern browsers increasingly block or warn about insecure HTTP content, which can degrade user trust.&lt;/li&gt;
&lt;li&gt;Enable HTTP Strict Transport Security (HSTS) to force HTTPS usage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why this matters:&lt;/strong&gt; Without HTTPS, attackers can intercept and modify scripts, injecting malicious code or stealing data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep Dependencies and Libraries Updated
&lt;/h2&gt;

&lt;p&gt;Modern JavaScript development relies heavily on third-party libraries and frameworks.&lt;/p&gt;

&lt;p&gt;We should regularly audit and update dependencies to patch security vulnerabilities.&lt;/p&gt;

&lt;p&gt;To do this, we can use tools like npm audit or Snyk to identify known issues.&lt;/p&gt;

&lt;p&gt;And we should avoid importing unnecessary or untrusted libraries.&lt;/p&gt;

&lt;p&gt;Attackers frequently exploit vulnerabilities in outdated or poorly maintained libraries.&lt;/p&gt;




&lt;h2&gt;
  
  
  Apply Principle of Least Privilege
&lt;/h2&gt;

&lt;p&gt;Grant only the minimal permissions necessary for your JavaScript code and related backend services.&lt;/p&gt;

&lt;p&gt;We should limit access scopes for API keys and tokens.&lt;/p&gt;

&lt;p&gt;Avoid exposing sensitive data unnecessarily in the frontend.&lt;/p&gt;

&lt;p&gt;Use roles and permissions for fine-grained access control.&lt;/p&gt;

&lt;p&gt;Reducing privileges limits the damage attackers can cause if they gain access.&lt;/p&gt;




&lt;h2&gt;
  
  
  Monitor and Log Suspicious Activity
&lt;/h2&gt;

&lt;p&gt;Security doesn’t stop at deployment.&lt;/p&gt;

&lt;p&gt;Implement logging for critical actions, authentication attempts, and errors.&lt;/p&gt;

&lt;p&gt;And we can monitor logs for unusual activity, failed login attempts, or spikes in traffic.&lt;/p&gt;

&lt;p&gt;Set up alerts to notify your team of potential security incidents.&lt;/p&gt;

&lt;p&gt;Early detection allows faster response to threats before damage escalates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Educate and Foster a Security Culture
&lt;/h2&gt;

&lt;p&gt;Finally, security is a mindset, not a checklist.&lt;/p&gt;

&lt;p&gt;Stay informed about the latest JavaScript vulnerabilities and fixes.&lt;/p&gt;

&lt;p&gt;Follow best practices and guidelines from trusted organizations like OWASP.&lt;/p&gt;

&lt;p&gt;Conducting regular security reviews and code audits.&lt;/p&gt;

&lt;p&gt;And encourage a culture of security awareness among developers is important since the best tools and practices fail if developers are unaware or complacent about security risks.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;JavaScript’s versatility and ubiquity make it a powerful tool for web developers, but it also demands careful attention to security. &lt;/p&gt;

&lt;p&gt;By sanitizing inputs, enforcing strict content policies, avoiding dangerous functions, securing cookies, implementing robust authentication, and maintaining vigilance through updates and monitoring, developers can significantly reduce the risk of security breaches.&lt;/p&gt;

&lt;p&gt;Security is an ongoing commitment, not a one-time effort. As web technologies evolve, so do attack techniques. Staying proactive and embracing best practices will help you build safer applications that protect your users and your reputation.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>security</category>
      <category>programming</category>
    </item>
    <item>
      <title>New Features with JavaScript in 2025</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Thu, 05 Jun 2025 00:24:45 +0000</pubDate>
      <link>https://dev.to/aumayeung/new-features-with-javascript-in-2025-549f</link>
      <guid>https://dev.to/aumayeung/new-features-with-javascript-in-2025-549f</guid>
      <description>&lt;p&gt;JavaScript continues to evolve rapidly, keeping pace with modern development needs and enabling developers to write cleaner, faster, and more efficient code. &lt;/p&gt;

&lt;p&gt;As we dive into 2025, the language has embraced several exciting new features and improvements that enhance productivity, readability, and performance.&lt;/p&gt;

&lt;p&gt;Here’s the most notable latest features in JavaScript:&lt;/p&gt;

&lt;h1&gt;
  
  
  Top-Level Await in Modules
&lt;/h1&gt;

&lt;p&gt;One of the biggest convenience improvements is the support for top-level await in JavaScript modules. Previously, you could only use await inside async functions, but now you can write:&lt;/p&gt;

&lt;p&gt;js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// top-level-await.js
const data = await fetch('https://api.example.com/data').then(res =&amp;gt; res.json());
console.log(data);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This simplifies asynchronous initialization logic without wrapping everything in an async function.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Temporal API
&lt;/h1&gt;

&lt;p&gt;Handling dates and times in JavaScript has been historically tricky. The new Temporal API aims to provide a modern, comprehensive, and reliable alternative to the Date object.&lt;/p&gt;

&lt;p&gt;js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const now = Temporal.Now.plainDateTimeISO();
console.log(now.toString()); // 2025-06-04T14:30:00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Temporal offers precise handling of time zones, durations, and calendar systems, drastically improving date-time manipulation.&lt;/p&gt;

&lt;h1&gt;
  
  
  Records and Tuples (Stage 3)
&lt;/h1&gt;

&lt;p&gt;JavaScript is introducing Records and Tuples, immutable data structures that help enforce immutability and value equality.&lt;/p&gt;

&lt;p&gt;Record: An immutable object&lt;/p&gt;

&lt;p&gt;Tuple: An immutable array&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const record = #{ name: "Alice", age: 30 };
const tuple = #[1, 2, 3];


console.log(record.name); // Alice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This feature encourages safer data handling patterns, especially in functional programming.&lt;/p&gt;

&lt;h1&gt;
  
  
  do Expressions (Stage 3)
&lt;/h1&gt;

&lt;p&gt;do expressions allow you to use statements as expressions, providing a way to write complex logic inline:&lt;/p&gt;

&lt;p&gt;js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const result = do {
  if (condition) {
    'yes';
  } else {
    'no';
  }
};
console.log(result); // "yes" or "no"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes conditional logic inside expressions cleaner and more expressive.&lt;/p&gt;

&lt;h1&gt;
  
  
  findLast and findLastIndex
&lt;/h1&gt;

&lt;p&gt;New array methods have been added to find the last element matching a condition:&lt;/p&gt;

&lt;p&gt;js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const numbers = [1, 3, 7, 9, 7];
console.log(numbers.findLast(n =&amp;gt; n &amp;lt; 8)); // 7
console.log(numbers.findLastIndex(n =&amp;gt; n &amp;lt; 8)); // 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These methods complement existing &lt;code&gt;find&lt;/code&gt; and &lt;code&gt;findIndex&lt;/code&gt;, improving array searching capabilities.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;findLast&lt;/code&gt; Returns the last element in an array that satisfies a given testing function.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;findLastIndex&lt;/code&gt; Returns the index of the last element in an array that satisfies a given testing function.&lt;/p&gt;

&lt;p&gt;These methods are the counterparts to the well-known &lt;code&gt;find&lt;/code&gt; and &lt;code&gt;findIndex&lt;/code&gt;, which return the first matching element or index. &lt;code&gt;findLast&lt;/code&gt; and &lt;code&gt;findLastIndex&lt;/code&gt; work from the end of the array backward, enabling more flexible searching patterns.&lt;/p&gt;

&lt;h1&gt;
  
  
  Error.cause Property
&lt;/h1&gt;

&lt;p&gt;Error handling has become more informative with the introduction of the cause property in error objects, helping track the root cause of errors:&lt;/p&gt;

&lt;p&gt;js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
  throw new Error("Original error");
} catch (err) {
  throw new Error("New error", { cause: err });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows better error chaining and debugging.&lt;/p&gt;

&lt;p&gt;The cause property is a relatively new addition to the JavaScript Error object that allows developers to associate an underlying cause with an error. &lt;/p&gt;

&lt;p&gt;This enables better error chaining and debugging by providing context about why an error occurred.&lt;/p&gt;

&lt;p&gt;Prior to cause, it was common to lose track of the original error when wrapping or rethrowing errors. &lt;code&gt;Error.cause&lt;/code&gt; makes it easier to preserve the error chain.&lt;/p&gt;

&lt;h1&gt;
  
  
  Ergonomic Brand Checks for Private Fields (Stage 3)
&lt;/h1&gt;

&lt;p&gt;Private fields in classes are easier to check with the new syntax:&lt;/p&gt;

&lt;p&gt;js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Person {
  #name = "Alice";
  hasNameField(obj) {
    return #name in obj;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Private fields are a way to declare properties on a class that are truly private — meaning they cannot be accessed or modified outside the class’s own methods. &lt;/p&gt;

&lt;p&gt;This provides true encapsulation, preventing external code from accidentally or intentionally interfering with internal state.&lt;/p&gt;

&lt;p&gt;Before private fields, developers relied on naming conventions (like prefixing with _) or closures to simulate privacy, but these were not enforced by the language. &lt;/p&gt;

&lt;p&gt;Private fields use a special syntax that guarantees privacy.&lt;/p&gt;

&lt;p&gt;Private fields are declared by prefixing the field name with a # character inside a class body:&lt;/p&gt;

&lt;p&gt;js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Person {
  #name;  // private field

  constructor(name) {
    this.#name = name;
  }

  getName() {
    return this.#name;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;The latest JavaScript features focus on making the language more expressive, efficient, and easier to work with. &lt;/p&gt;

&lt;p&gt;From asynchronous programming improvements like top-level await, to robust new APIs such as Temporal for date-time handling, and immutable data structures like Records and Tuples, these updates help developers write cleaner and more maintainable code. &lt;/p&gt;

&lt;p&gt;Additional enhancements in error handling and private field management further improve debugging and encapsulation. &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to search array of arrays with JavaScript?</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Mon, 14 Nov 2022 23:35:23 +0000</pubDate>
      <link>https://dev.to/aumayeung/how-to-search-array-of-arrays-with-javascript-25p5</link>
      <guid>https://dev.to/aumayeung/how-to-search-array-of-arrays-with-javascript-25p5</guid>
      <description>&lt;p&gt;To search array of arrays with JavaScript, we use the array &lt;code&gt;some&lt;/code&gt; and &lt;code&gt;every&lt;/code&gt; methods.&lt;/p&gt;

&lt;p&gt;For instance, we write&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const ar = [
  [2, 6, 89, 45],
  [3, 566, 23, 79],
  [434, 677, 9, 23],
];

const val = [3, 566, 23, 79];

const bool = ar.some((arr) =&amp;gt; {
  return arr.every((prop, index) =&amp;gt; {
    return val[index] === prop;
  });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to call &lt;code&gt;some&lt;/code&gt; with a callback that searches every element of the nested array to check if they're equal with &lt;code&gt;every&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We call &lt;code&gt;every&lt;/code&gt; with a callback that check the index of &lt;code&gt;arr&lt;/code&gt; to see if it's equal to &lt;code&gt;prop&lt;/code&gt; in the nested array.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>How to remove item from array using its name / value with JavaScript?</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Mon, 14 Nov 2022 23:35:02 +0000</pubDate>
      <link>https://dev.to/aumayeung/how-to-remove-item-from-array-using-its-name-value-with-javascript-33id</link>
      <guid>https://dev.to/aumayeung/how-to-remove-item-from-array-using-its-name-value-with-javascript-33id</guid>
      <description>&lt;p&gt;To remove item from array using its name / value with JavaScript, we use the &lt;code&gt;filter&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;For instance, we write&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const COUNTRY_ID = "AL";

countries.results = countries.results.filter((el) =&amp;gt; {
  return el.id !== COUNTRY_ID;
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to call &lt;code&gt;filter&lt;/code&gt; with a callback to return an array within the &lt;code&gt;countries.results&lt;/code&gt; array without the object with &lt;code&gt;id&lt;/code&gt; not equal to &lt;code&gt;COUNTRY_ID&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>How to alert an array with JavaScript?</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Mon, 14 Nov 2022 23:34:08 +0000</pubDate>
      <link>https://dev.to/aumayeung/how-to-alert-an-array-with-javascript-2bjf</link>
      <guid>https://dev.to/aumayeung/how-to-alert-an-array-with-javascript-2bjf</guid>
      <description>&lt;p&gt;To alert an array with JavaScript, we convert it to a string before calling &lt;code&gt;alert&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For instance, we write&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alert(JSON.stringify(aCustomers));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to call &lt;code&gt;JSON.stringify&lt;/code&gt; to convert the &lt;code&gt;aCustomers&lt;/code&gt; array to a JSON array string.&lt;/p&gt;

&lt;p&gt;Then we call &lt;code&gt;alery&lt;/code&gt; with the string to show an alert box with the array string.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>How to find if object property exists in an array with Lodash and JavaScript?</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Mon, 14 Nov 2022 23:33:50 +0000</pubDate>
      <link>https://dev.to/aumayeung/how-to-find-if-object-property-exists-in-an-array-with-lodash-and-javascript-3ng2</link>
      <guid>https://dev.to/aumayeung/how-to-find-if-object-property-exists-in-an-array-with-lodash-and-javascript-3ng2</guid>
      <description>&lt;p&gt;To find if object property exists in an array with Lodash and JavaScript, we use the &lt;code&gt;has&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;For instance, we write&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const countries = { country: { name: "France" } };
const isExist = _.has(countries, "country.name");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to call &lt;code&gt;has&lt;/code&gt; with the &lt;code&gt;countries&lt;/code&gt; object and the property to look for in each object.&lt;/p&gt;

&lt;p&gt;Therefore, &lt;code&gt;isExist&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt; since &lt;code&gt;country.name&lt;/code&gt; is in the &lt;code&gt;countries&lt;/code&gt; object.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>How to move to prev/next element of an array with JavaScript?</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Mon, 14 Nov 2022 23:33:22 +0000</pubDate>
      <link>https://dev.to/aumayeung/how-to-move-to-prevnext-element-of-an-array-with-javascript-1973</link>
      <guid>https://dev.to/aumayeung/how-to-move-to-prevnext-element-of-an-array-with-javascript-1973</guid>
      <description>&lt;p&gt;To move to prev/next element of an array with JavaScript, we can define our own array class.&lt;/p&gt;

&lt;p&gt;For instance, we write&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class TraversableArray extends Array {
  next() {
    return this[++this.current];
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to define the &lt;code&gt;TraversableArray&lt;/code&gt; class that extends the &lt;code&gt;Array&lt;/code&gt; class.&lt;/p&gt;

&lt;p&gt;In it, we add the &lt;code&gt;next&lt;/code&gt; method that returns the object at the &lt;code&gt;current&lt;/code&gt; index after incrementing it by 1.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>How to update the attribute value of an object using the map function in JavaScript?</title>
      <dc:creator>John Au-Yeung</dc:creator>
      <pubDate>Sun, 13 Nov 2022 06:53:31 +0000</pubDate>
      <link>https://dev.to/aumayeung/how-to-update-the-attribute-value-of-an-object-using-the-map-function-in-javascript-1737</link>
      <guid>https://dev.to/aumayeung/how-to-update-the-attribute-value-of-an-object-using-the-map-function-in-javascript-1737</guid>
      <description>&lt;p&gt;To update the attribute value of an object using the map function in JavaScript, we return the updated object.&lt;/p&gt;

&lt;p&gt;For instance, we write&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;editSchoolName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;schools&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;oldName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="nx"&gt;schools&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;oldName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to define the &lt;code&gt;editSchooName&lt;/code&gt; function that returns a new version of the &lt;code&gt;schools&lt;/code&gt; array that has entries mapped from &lt;code&gt;schools&lt;/code&gt; with the objects updated if they have &lt;code&gt;name&lt;/code&gt; property equal to &lt;code&gt;oldName&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
  </channel>
</rss>
