<?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: Aya Ishimura</title>
    <description>The latest articles on DEV Community by Aya Ishimura (@aya02200220).</description>
    <link>https://dev.to/aya02200220</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F918149%2Fd0b3b6dc-176e-4828-8579-4aa334a3dc36.jpeg</url>
      <title>DEV Community: Aya Ishimura</title>
      <link>https://dev.to/aya02200220</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aya02200220"/>
    <language>en</language>
    <item>
      <title>Overcoming Deployment Challenges with a MERN Stack application on Vercel</title>
      <dc:creator>Aya Ishimura</dc:creator>
      <pubDate>Sun, 17 Sep 2023 06:38:21 +0000</pubDate>
      <link>https://dev.to/aya02200220/overcoming-deployment-challenges-with-a-mern-stack-blog-on-vercel-3p12</link>
      <guid>https://dev.to/aya02200220/overcoming-deployment-challenges-with-a-mern-stack-blog-on-vercel-3p12</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;:&lt;br&gt;
Deploying a MERN stack application, especially the server-side code, on platforms like Vercel can be a daunting task. Navigating through the myriad of configurations and dealing with unexpected issues can be overwhelming. In this article, I'll share the challenges I faced while deploying my MERN blog site's server-side code on Vercel and how I overcame them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Configuring Vercel for Server-Side Code&lt;/strong&gt;:&lt;br&gt;
To ensure Vercel recognized my server-side code, I added a &lt;code&gt;vercel.json&lt;/code&gt; configuration file at the root of my server code. This file directs Vercel on how to build and route requests for the server:&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;"version"&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;"builds"&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;"src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"index.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"use"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"@vercel/node"&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;"routes"&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;"src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&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;"dest"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/index.js"&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="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this configuration in place, any request made to my deployed application would be directed to &lt;code&gt;index.js&lt;/code&gt;, where my server-side code resides.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Migrating from bcrypt to bcryptjs&lt;/strong&gt;:&lt;br&gt;
During the deployment phase, I encountered an issue with the &lt;code&gt;bcrypt&lt;/code&gt; package. It wasn't compiling correctly, which can sometimes be a common issue due to platform-specific binary dependencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: &lt;br&gt;
To overcome this problem, I switched to using &lt;code&gt;bcryptjs&lt;/code&gt;, which is a pure JavaScript implementation, eliminating the need for platform-specific binaries. The change was straightforward:&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="c1"&gt;// Before:&lt;/span&gt;
&lt;span class="c1"&gt;// const bcrypt = require("bcrypt");&lt;/span&gt;

&lt;span class="c1"&gt;// After:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bcrypt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bcryptjs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By making this shift, I was able to seamlessly continue hashing passwords and verifying them without the compilation issues I faced with &lt;code&gt;bcrypt&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Understanding Cookies and Security&lt;/strong&gt;:&lt;br&gt;
One of the most common issues developers face during deployment is handling cookies, especially when it comes to security configurations. I observed that while tokens were saved in the local testing environment, they weren't stored when connecting to the deployed server. After some debugging, I realized:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Local vs Production&lt;/strong&gt;: The difference between HTTP (local) and HTTPS (production) played a role in this behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SameSite Attribute&lt;/strong&gt;: A warning about the SameSite attribute indicated that cross-site responses were being blocked.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: By ensuring proper configurations for &lt;code&gt;SameSite&lt;/code&gt;, I was able to ensure that tokens were saved properly.&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="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cookie&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;token&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;httpOnly&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
      &lt;span class="na"&gt;secure&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;sameSite&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Before:sameSite: "lax",&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Configuring CORS for Multiple Origins&lt;/strong&gt;:&lt;br&gt;
CORS (Cross-Origin Resource Sharing) policies can be a major pain point when deploying applications. I had to make sure my server accepted requests from various URLs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The automatically assigned Vercel URL&lt;/li&gt;
&lt;li&gt;My custom domain&lt;/li&gt;
&lt;li&gt;The default Vercel project URL&lt;/li&gt;
&lt;li&gt;Localhost, for testing purposes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: I updated the &lt;code&gt;allowedOrigins&lt;/code&gt; array in my server configuration, allowing requests from all these sources. However, it's essential to remember that for maximum security, it's best to limit the origins to only the necessary ones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Route Order Importance&lt;/strong&gt;:&lt;br&gt;
In Express.js, the order of middleware and routes is critical. If not structured correctly, some routes or middleware may not function as expected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: By ensuring that specific routes and middleware were loaded in the correct sequence, I was able to maintain the desired functionality across the server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;:&lt;br&gt;
Deployment can often be a challenging phase in a project's lifecycle, but with persistence and a systematic debugging approach, one can resolve most issues. My experience with deploying the MERN stack blog site on Vercel taught me the importance of understanding deployment configurations and fine-tuning them according to the platform's requirements.&lt;/p&gt;

&lt;p&gt;I hope my experience can assist others in their deployment journeys. Always remember, every challenge is a new learning opportunity.&lt;/p&gt;

</description>
      <category>mern</category>
      <category>vercel</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why Isn't the Token Being Saved in the Cookie?</title>
      <dc:creator>Aya Ishimura</dc:creator>
      <pubDate>Tue, 22 Aug 2023 04:10:33 +0000</pubDate>
      <link>https://dev.to/aya02200220/why-isnt-the-token-being-saved-in-the-cookie-1dmp</link>
      <guid>https://dev.to/aya02200220/why-isnt-the-token-being-saved-in-the-cookie-1dmp</guid>
      <description>&lt;p&gt;In web development, we occasionally come across issues that are puzzling and time-consuming to solve. One such issue that I recently faced involved JWT tokens not being stored in cookies for specific users. I invested several days trying to resolve this issue and eventually found a solution. In this blog post, I will share the details of the problem and the steps I took to resolve it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem:
&lt;/h2&gt;

&lt;p&gt;In my web application, I utilized JWT (JSON Web Token) for user authentication. After a successful login, the server would send a JWT token to the client, which was supposed to be stored in a cookie. However, for certain users, the token was not being stored in the cookie. The perplexing part was that this issue only occurred for specific users and was not consistent across all users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Investigation:
&lt;/h2&gt;

&lt;p&gt;I began by examining the server's response headers for the problematic users. To my astonishment, the "Set-Cookie" header was present, and a token was indeed being sent. Nonetheless, the token was not appearing in the browser's cookie storage. After a deeper investigation, I noticed that the problematic users had an unusually long token compared to other users.&lt;/p&gt;

&lt;p&gt;The following code was creating tokens that were too long, causing the problem:&lt;/p&gt;

&lt;h2&gt;
  
  
  Root Cause:
&lt;/h2&gt;

&lt;p&gt;It became clear that the issue stemmed from the token's size. For the problematic users, the JWT token was too large to be stored in a cookie. Browsers impose a limit on the maximum size of a cookie, and the token was exceeding this limit. This occurred because the token payload for these users contained a large amount of data, making the token exceptionally lengthy.&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;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;followers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;followers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;userIcon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;userIcon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;following&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;following&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;bio&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bio&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;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;signToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution:
&lt;/h2&gt;

&lt;p&gt;To address the problem, I modified the token generation logic to include only essential information in the payload. By reducing the amount of data in the token, I was able to ensure that the token's size remained within the limits imposed by browsers. After implementing this change, the tokens were successfully stored in the cookies for all users.&lt;/p&gt;

&lt;p&gt;I revised it to the following:&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;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;email&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;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;signToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This issue underscored the importance of considering the size of data being sent in tokens and cookies. By including only essential information in the token and ensuring that its size stays within the browser's limits, I was able to avert this problem in the future. I hope that sharing my experience will be helpful to others facing similar challenges.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Quick Tips: Styling MUI Components with the sx Prop</title>
      <dc:creator>Aya Ishimura</dc:creator>
      <pubDate>Thu, 13 Jul 2023 03:50:06 +0000</pubDate>
      <link>https://dev.to/aya02200220/material-ui-1k03</link>
      <guid>https://dev.to/aya02200220/material-ui-1k03</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;Elevate Your MUI Components: Mastering the &lt;code&gt;sx&lt;/code&gt; Prop for Styling&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Material-UI (now known as MUI) has always been a popular choice among React developers for its rich component library and flexibility. One of the game-changers introduced in MUI is the &lt;code&gt;sx&lt;/code&gt; prop, which provides a powerful and concise way to style components directly. In today's quick tip, we'll explore how to use the &lt;code&gt;sx&lt;/code&gt; prop to change button hover effects and to integrate images seamlessly into Box components.&lt;/p&gt;




&lt;p&gt;To change a button color on hover with MUI, you can use the inline css &lt;code&gt;sx&lt;/code&gt; prop with ":hover".&lt;/p&gt;

&lt;p&gt;Example:&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="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;sx&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;bgcolor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#525252&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="s2"&gt;:hover&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;bgcolor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#5c5c5c&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="s2"&gt;white&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="si"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
Click Me
&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To put an image into a box component, you can set 'component="img"'.&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Box&lt;/span&gt;
   &lt;span class="na"&gt;component&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"img"&lt;/span&gt;
   &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`http://localhost:4000/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;cover&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
   &lt;span class="na"&gt;sx&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="c1"&gt;// Match the width of the image to the parent element&lt;/span&gt;
        &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;100%&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
        &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;auto&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
        &lt;span class="na"&gt;maxWidth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;250px&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
        &lt;span class="na"&gt;maxHeight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;200px&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
        &lt;span class="na"&gt;borderRadius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;10px&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;objectFit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cover&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="si"&gt;}&lt;/span&gt;
 &lt;span class="p"&gt;&amp;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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Mastering the Basics: Manipulating the DOM with JavaScript</title>
      <dc:creator>Aya Ishimura</dc:creator>
      <pubDate>Fri, 10 Feb 2023 14:28:13 +0000</pubDate>
      <link>https://dev.to/aya02200220/we-have-to-kill-our-impostor-syndrome--40c3</link>
      <guid>https://dev.to/aya02200220/we-have-to-kill-our-impostor-syndrome--40c3</guid>
      <description>&lt;p&gt;The Document Object Model (DOM) is a programming interface for HTML and XML documents that allows developers to manipulate web pages dynamically with JavaScript. By representing an HTML document as a tree structure, the DOM provides a convenient way to traverse, select, and modify elements on the page. In this article, we will cover the basics of how to manipulate the DOM with JavaScript.&lt;/p&gt;

&lt;p&gt;To start, you need to select an element in the DOM. This is done using methods like getElementById, querySelector, or querySelectorAll. Once you have a reference to an element, you can change its properties, such as its style or content, using the properties provided by the DOM API. For example, to change the background color of an element with an ID of element, you would use the following code:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Javascript&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; document.getElementById("element").style.backgroundColor = "red";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also add, remove, or move elements in the DOM using JavaScript. For example, to add a new p element to the end of a div element, you would use the following code:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Javascript&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let div = document.getElementById("container");
let p = document.createElement("p");
p.innerHTML = "Hello World";
div.appendChild(p);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To remove an element, you can use the removeChild method. For example, to remove the newly created p element, you would use the following code:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;css&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div.removeChild(p);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you need to move an element from one location to another, you can use the insertBefore method. For example, to move the p element to the beginning of the div element, you would use the following code:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;css&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div.insertBefore(p, div.firstChild);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In addition to these basic manipulation methods, the DOM provides several events that allow you to respond to user interactions, such as clicks, hovers, and form submissions. You can attach event listeners to elements using the addEventListener method. For example, to run a function when a button is clicked, you would use the following code:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;javascript&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let button = document.getElementById("button");
button.addEventListener("click", function() {
  alert("Button clicked!");
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's worth noting that not all browsers implement the DOM API in exactly the same way, so it's important to test your code in multiple browsers to ensure compatibility. Additionally, the DOM API can be slow and inefficient for large or complex documents, so it's important to optimize your code and use tools like the Chrome DevTools to identify performance bottlenecks.&lt;/p&gt;

&lt;p&gt;In conclusion, the DOM provides a powerful and flexible way to manipulate web pages with JavaScript. By selecting elements, changing their properties, adding and removing elements, and responding to user interactions, you can create rich, interactive web applications. Whether you're building a simple website or a complex web application, understanding the DOM is an essential part of web development.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>About me</title>
      <dc:creator>Aya Ishimura</dc:creator>
      <pubDate>Wed, 31 Aug 2022 02:55:19 +0000</pubDate>
      <link>https://dev.to/aya02200220/about-me-mg8</link>
      <guid>https://dev.to/aya02200220/about-me-mg8</guid>
      <description>&lt;p&gt;Hello, I'm Aya. Let me share with you my journey to becoming a passionate web developer.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Discovering My Drive&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I've always been someone who sought genuine passion in what I do. For a long time, I drifted without a true calling, feeling moments of anxiety about the direction of my life. But when I stumbled upon programming, it felt like I'd finally found my place. It was a moment of realization – "This is it."&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;My First Brush with Coding&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;While working as an office assistant in Japan, I was introduced to VBA for automating Excel tasks. The joy of streamlining processes and making tasks more efficient was palpable. What started as personal projects to automate my tasks ended up getting recognized at the highest levels, leading to a promotion and even an award for our department.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Diving Deeper into Web Development&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Despite my accomplishments with VBA, I knew there was more to explore. My love for logic-driven tasks, reminiscent of my fondness for mathematics, made programming a natural fit. As technology advanced, I was drawn to web development, envisioning the thrill of crafting my own websites and desiring to attain business-level English proficiency to expand my horizons.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Embracing Change: Moving to Canada&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Originally planning to study in Australia, the COVID-19 pandemic shifted my trajectory to Canada, where the co-op system offered the enticing blend of study and real-world internships. Recognizing the importance of experience in the IT sector, I saw this as an invaluable opportunity.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Building My Foundation&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Navigating the world of web development as a newcomer isn't without its challenges. While job postings often seek prior experience, I took the initiative. By offering to build a website for my friends' business, I am converting theoretical knowledge into practical skills, laying the groundwork for my career.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;My Vision for the Future&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;My goal is clear: to be a self-sufficient web developer, crafting complete websites from scratch. With just a laptop, internet, and a burst of creativity, I envision myself working from anywhere in the world. It might be a challenging journey, but with my passion and dedication, I am confident in my path.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
