<?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: Koichi Kimura</title>
    <description>The latest articles on DEV Community by Koichi Kimura (@kupumaru21).</description>
    <link>https://dev.to/kupumaru21</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%2F1394253%2Ff9e13ca4-8e3f-4dbd-b9bd-6a6be9ff03d5.jpeg</url>
      <title>DEV Community: Koichi Kimura</title>
      <link>https://dev.to/kupumaru21</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kupumaru21"/>
    <language>en</language>
    <item>
      <title>JSX Curly Braces {} Got Your Back Behind the Scenes</title>
      <dc:creator>Koichi Kimura</dc:creator>
      <pubDate>Sat, 10 May 2025 19:29:48 +0000</pubDate>
      <link>https://dev.to/kupumaru21/jsx-curly-braces-got-your-back-behind-the-scenes-ap1</link>
      <guid>https://dev.to/kupumaru21/jsx-curly-braces-got-your-back-behind-the-scenes-ap1</guid>
      <description>&lt;h2&gt;
  
  
  Have you ever wondered what &lt;code&gt;&amp;lt;h1&amp;gt;{title}&amp;lt;/h1&amp;gt;&lt;/code&gt; really does?
&lt;/h2&gt;

&lt;p&gt;At first glance, it looks like just a way to inject JavaScript variables into JSX.&lt;br&gt;&lt;br&gt;
But there's more to it.&lt;br&gt;
It’s not just syntax.&lt;br&gt;&lt;br&gt;
It’s &lt;strong&gt;security&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  JSX Escapes by Default 🛡️
&lt;/h2&gt;

&lt;p&gt;React automatically escapes any content inside JSX curly braces before rendering it to the DOM.&lt;br&gt;&lt;br&gt;
That means special characters like &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;, and &lt;code&gt;&amp;amp;&lt;/code&gt; are safely converted, preventing malicious HTML or JavaScript from being interpreted.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;script&amp;gt;alert("XSS")&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// JSX escapes it automatically&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="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&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;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;&lt;span class="ni"&gt;&amp;amp;lt;&lt;/span&gt;script&lt;span class="ni"&gt;&amp;amp;gt;&lt;/span&gt;alert("XSS")&lt;span class="ni"&gt;&amp;amp;lt;&lt;/span&gt;/script&lt;span class="ni"&gt;&amp;amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ No script executed. Just safe, visible text.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🔗 &lt;a href="https://legacy.reactjs.org/docs/introducing-jsx.html" rel="noopener noreferrer"&gt;By default, React DOM escapes any values embedded in JSX before rendering them.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Imagine this value came from user input (e.g., a comment form or a URL parameter).&lt;br&gt;&lt;br&gt;
If React didn’t escape it, this line:&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="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;userInput&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&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;could become an open door to XSS (Cross-site Scripting) attacks. But thanks to React's design, it's safe by default.&lt;/p&gt;




&lt;h2&gt;
  
  
  What About &lt;code&gt;dangerouslySetInnerHTML&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;Now, this is where you need to be careful:&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="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;This bypasses React's escape mechanism.&lt;br&gt;
If you use this, you’re telling React:&lt;br&gt;
"I know what I'm doing. Trust me, this HTML is safe."&lt;br&gt;
Which means... you need to sanitize it yourself using something like DOMPurify.&lt;/p&gt;


&lt;h2&gt;
  
  
  The Takeaway 🎯
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;{}&lt;/code&gt; in JSX is more than just a way to embed variables.&lt;/p&gt;

&lt;p&gt;It’s a &lt;strong&gt;safety mechanism&lt;/strong&gt; that protects your app from script injection.&lt;/p&gt;

&lt;p&gt;Unless you explicitly bypass it, JSX makes your rendering safe by default.&lt;/p&gt;

&lt;p&gt;So next time you write 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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&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;Remember — React’s got your back. 😉&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>security</category>
    </item>
    <item>
      <title>Tired of losing your cursor when switching tabs in VSCode? Meet Cursorghost 👻</title>
      <dc:creator>Koichi Kimura</dc:creator>
      <pubDate>Sun, 23 Mar 2025 22:40:51 +0000</pubDate>
      <link>https://dev.to/kupumaru21/tired-of-losing-your-cursor-when-switching-tabs-in-vscode-meet-cursorghost-23ni</link>
      <guid>https://dev.to/kupumaru21/tired-of-losing-your-cursor-when-switching-tabs-in-vscode-meet-cursorghost-23ni</guid>
      <description>&lt;p&gt;Have you ever switched tabs in VSCode and forgotten where your cursor was?&lt;/p&gt;

&lt;p&gt;This happens to me &lt;strong&gt;all the time&lt;/strong&gt;, especially when jumping between multiple files in large codebases.&lt;/p&gt;

&lt;p&gt;So… I built a tiny VSCode extension to solve it.&lt;/p&gt;

&lt;h2&gt;
  
  
  👻 What is Cursorghost?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=kupuma-ru21.Cursorghost" rel="noopener noreferrer"&gt;&lt;strong&gt;Cursorghost&lt;/strong&gt;&lt;/a&gt; is a lightweight VSCode extension that remembers your cursor position in each file tab — and restores it automatically when you switch back.&lt;/p&gt;

&lt;p&gt;No setup needed. Just install it, and it works.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://marketplace.visualstudio.com/items?itemName=kupuma-ru21.Cursorghost" rel="noopener noreferrer"&gt;Marketplace Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fkupuma-ru21%2Fcursorghost%2Fmain%2Fimages%2Fdemo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fkupuma-ru21%2Fcursorghost%2Fmain%2Fimages%2Fdemo.gif" alt="Demo" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Why I built this
&lt;/h2&gt;

&lt;p&gt;I got tired of constantly losing my cursor position and manually scrolling back to where I was editing. VSCode doesn’t remember the position across tabs by default, so I decided to write my own solution.&lt;/p&gt;

&lt;p&gt;I wanted it to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Be automatic and seamless&lt;/li&gt;
&lt;li&gt;Work across all file types&lt;/li&gt;
&lt;li&gt;Require no config&lt;/li&gt;
&lt;li&gt;Be easy to install and forget&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛠️ How it works (under the hood)
&lt;/h2&gt;

&lt;p&gt;In short:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It listens for &lt;code&gt;onDidChangeActiveTextEditor&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;It stores the current cursor line whenever you switch away&lt;/li&gt;
&lt;li&gt;When you come back, it restores the last known position&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All written in TypeScript. The source is open on GitHub:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://github.com/kupuma-ru21/cursorghost" rel="noopener noreferrer"&gt;GitHub - kupuma-ru21/cursorghost&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 How to use it
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open VSCode Extensions and search &lt;code&gt;Cursorghost&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click install&lt;/li&gt;
&lt;li&gt;Switch tabs and feel the magic! ✨&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No configuration required.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧩 Ideas for future features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Diff view support&lt;/li&gt;
&lt;li&gt;Multi-cursor support&lt;/li&gt;
&lt;li&gt;Exclude certain files/types&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’m open to feedback and PRs!&lt;/p&gt;




&lt;h2&gt;
  
  
  🙏 Final thoughts
&lt;/h2&gt;

&lt;p&gt;Sometimes it’s the little things that make your workflow feel smoother.&lt;br&gt;&lt;br&gt;
I hope Cursorghost saves you some frustration like it did for me.&lt;/p&gt;

&lt;p&gt;If you try it and find it helpful, please ⭐️ the &lt;a href="https://github.com/kupuma-ru21/cursorghost" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt; and share it with others!&lt;/p&gt;

&lt;p&gt;Let me know what you think — and thanks for reading 👋&lt;/p&gt;




&lt;p&gt;💻 Built by &lt;a href="https://github.com/kupuma-ru21" rel="noopener noreferrer"&gt;@kupuma-ru21&lt;/a&gt;  &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Are you still using getYear method in Javascript??</title>
      <dc:creator>Koichi Kimura</dc:creator>
      <pubDate>Sat, 25 May 2024 07:25:59 +0000</pubDate>
      <link>https://dev.to/kupumaru21/are-you-still-using-getyear-method-264e</link>
      <guid>https://dev.to/kupumaru21/are-you-still-using-getyear-method-264e</guid>
      <description>&lt;p&gt;I've worked as a frontend developer for 4 years.&lt;br&gt;
I mean, I've used &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getYear"&gt;&lt;code&gt;getYear&lt;/code&gt;&lt;/a&gt; method a lot.&lt;br&gt;
But I have to say good bye to it. 😭&lt;br&gt;
Because it's no longer recomended because of "year 2000 problem".&lt;br&gt;
So let's use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getFullYear"&gt;&lt;code&gt;getFullYear&lt;/code&gt;&lt;/a&gt; method!!&lt;/p&gt;

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