<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>ReactJS &amp;mdash; Attach to Process</title>
    <link>https://devblog.dinobansigan.com/tag:ReactJS</link>
    <description>Thoughts and Notes on Software Development</description>
    <pubDate>Mon, 13 Apr 2026 21:59:32 +0000</pubDate>
    <image>
      <url>https://i.snap.as/4wmUdb6N.png</url>
      <title>ReactJS &amp;mdash; Attach to Process</title>
      <link>https://devblog.dinobansigan.com/tag:ReactJS</link>
    </image>
    <item>
      <title>DevNotes - 005</title>
      <link>https://devblog.dinobansigan.com/devnotes-005?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[Fire and forget template for C#/.NET to run something that you don&#39;t need to wait on and don&#39;t care about the results.&#xA;Task.Run(() =  {&#xA;&#x9;//code goes here&#xA;});&#xA;---&#xA;&#xA;In ReactJS, if ESLint says you cannot use inline arrow functions to pass in props in JSX, a solution is to wrap them with the useCallback hook.&#xA;&#xA;Reference: https://stackoverflow.com/a/36677798/5041911&#xA;&#xA;---&#xA;&#xA;Modals -- can be used to add dialog or popup info boxes on your ReactJS app.&#xA;&#xA;---&#xA;&#xA;So using this library actually helped me solve my Azure Application Insights logging issue. The issue being, since I had a dateOfBirth object in my formData object, app insights would save it as an object, as opposed to something like dateOfBirth: 2024-04-16. The solution was to flatten the formData object so it will get logged properly in Azure App Insights.&#xA;&#xA;---&#xA;&#xA;Rendering the HTML string in React -- short tutorial on how to render an HTML string in ReactJS/Gatsby.&#xA;&#xA;---&#xA;&#xA;Series: #DevNotes&#xA;Tags: #CSharp #DotNet #Template #ReactJS #Azure #ApplicationInsights #Gatsby&#xA;&#xA;!--emailsub--&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/devnotes-005&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>Fire and forget template for C#/.NET to run something that you don&#39;t need to wait on and don&#39;t care about the results.</p>

<pre><code class="language-csharp">Task.Run(() =&gt;
{
	//code goes here
});
</code></pre>

<hr/>

<p>In ReactJS, if ESLint says you cannot use inline arrow functions to pass in props in JSX, a solution is to wrap them with the <code>useCallback</code> hook.</p>

<p>Reference: <a href="https://stackoverflow.com/a/36677798/5041911">https://stackoverflow.com/a/36677798/5041911</a></p>

<hr/>

<p><a href="https://react-bootstrap.netlify.app/docs/components/modal/">Modals</a> — can be used to add dialog or popup info boxes on your ReactJS app.</p>

<hr/>

<p>So using <a href="https://www.npmjs.com/package/flat">this library</a> actually helped me solve my Azure Application Insights logging issue. The issue being, since I had a <code>dateOfBirth</code> object in my <code>formData</code> object, app insights would save it as an object, as opposed to something like <code>dateOfBirth: 2024-04-16</code>. The solution was to flatten the <code>formData</code> object so it will get logged properly in Azure App Insights.</p>

<hr/>

<p><a href="https://reactgo.com/react-render-html/">Rendering the HTML string in React</a> — short tutorial on how to render an HTML string in ReactJS/Gatsby.</p>

<hr/>

<p><strong>Series:</strong> <a href="https://devblog.dinobansigan.com/tag:DevNotes" class="hashtag"><span>#</span><span class="p-category">DevNotes</span></a>
<strong>Tags:</strong> <a href="https://devblog.dinobansigan.com/tag:CSharp" class="hashtag"><span>#</span><span class="p-category">CSharp</span></a> <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:Template" class="hashtag"><span>#</span><span class="p-category">Template</span></a> <a href="https://devblog.dinobansigan.com/tag:ReactJS" class="hashtag"><span>#</span><span class="p-category">ReactJS</span></a> <a href="https://devblog.dinobansigan.com/tag:Azure" class="hashtag"><span>#</span><span class="p-category">Azure</span></a> <a href="https://devblog.dinobansigan.com/tag:ApplicationInsights" class="hashtag"><span>#</span><span class="p-category">ApplicationInsights</span></a> <a href="https://devblog.dinobansigan.com/tag:Gatsby" class="hashtag"><span>#</span><span class="p-category">Gatsby</span></a></p>



<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/devnotes-005">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/devnotes-005</guid>
      <pubDate>Tue, 23 Apr 2024 17:18:27 +0000</pubDate>
    </item>
    <item>
      <title>DevNotes - 003</title>
      <link>https://devblog.dinobansigan.com/devnotes-003?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[Cache Implementations in C# .NET -- good blog post on implementing caching with .NET.&#xA;&#xA;---&#xA;&#xA;You&#39;re using HttpClient wrong and it is destabilizing your software -- great blog post that told me that we should avoid the use of the &#34;using statement&#34; when working with an HttpClient instance. And that&#39;s because disposing it after say a one time use, like doing one API call and then immediately disposing, will leave open/pending socket connections. Do this often enough and you&#39;ll accumulate a number of those open/pending socket connections and that will slow down your app. The better approach is to use a single static HttpClient instance in your app.&#xA;&#xA;---&#xA;&#xA;The always-recent guide to creating a development environment for Node and React (with Babel and Webpack) -- good guide to setting up a full-stack JavaScript development environment on your local, with an eye toward ReactJS.!--more--&#xA;&#xA;---&#xA;&#xA;Good blog posts on how to create Windows Services using .NET Core:&#xA;&#xA;Creating Windows Services In .NET Core – Part 1 – The “Microsoft” Way&#xA;Creating Windows Services In .NET Core – Part 2 – The “Topshelf” Way&#xA;&#xA;---&#xA;&#xA;Combining multiple changes into one commit is a bad idea, because then you cannot revert the single change that you want to revert, without reverting all the other changes that came along with it.&#xA;&#xA;---&#xA;&#xA;Inadvertently discovered a way to find out who is running a specific process on a server. This is useful if you cannot remote into the server, like say because the connections are full. Using Visual Studio, you can do &#34;Attach to Process&#34; on a server. Assuming that server is setup with remote debugging, doing so will get you a listing of the apps/processes running on that server, plus which user are running those apps/processes.&#xA;&#xA;And now you know where I got the name for this blog as well.&#xA;&#xA;---&#xA;&#xA;Tags: #DevNotes #Bookmarks #DotNet #Caching #HttpClient #ReactJS  #WindowsServices #SourceControlBestPractices #TroubleshootingWindowsProcesses&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/devnotes-003&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://michaelscodingspot.com/cache-implementations-in-csharp-net/">Cache Implementations in C# .NET</a> — good blog post on implementing caching with .NET.</p>

<hr/>

<p><a href="https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/">You&#39;re using HttpClient wrong and it is destabilizing your software</a> — great blog post that told me that we should avoid the use of the “using statement” when working with an <code>HttpClient</code> instance. And that&#39;s because disposing it after say a one time use, like doing one API call and then immediately disposing, will leave open/pending socket connections. Do this often enough and you&#39;ll accumulate a number of those open/pending socket connections and that will slow down your app. The better approach is to use a single static <code>HttpClient</code> instance in your app.</p>

<hr/>

<p><a href="https://jscomplete.com/learn/1rd-reactful">The always-recent guide to creating a development environment for Node and React (with Babel and Webpack)</a> — good guide to setting up a full-stack JavaScript development environment on your local, with an eye toward ReactJS.</p>

<hr/>

<p>Good blog posts on how to create Windows Services using .NET Core:</p>
<ul><li><a href="https://dotnetcoretutorials.com/2019/09/19/creating-windows-services-in-net-core-part-1-the-microsoft-way/">Creating Windows Services In .NET Core – Part 1 – The “Microsoft” Way</a></li>
<li><a href="https://dotnetcoretutorials.com/2019/09/27/creating-windows-services-in-net-core-part-2-the-topshelf-way/">Creating Windows Services In .NET Core – Part 2 – The “Topshelf” Way</a></li></ul>

<hr/>

<p>Combining multiple changes into one commit is a bad idea, because then you cannot revert the single change that you want to revert, without reverting all the other changes that came along with it.</p>

<hr/>

<p>Inadvertently discovered a way to find out who is running a specific process on a server. This is useful if you cannot remote into the server, like say because the connections are full. Using Visual Studio, you can do <strong>“Attach to Process”</strong> on a server. Assuming that server is setup with remote debugging, doing so will get you a listing of the apps/processes running on that server, plus which user are running those apps/processes.</p>

<p><em>And now you know where I got the name for this blog as well.</em></p>

<hr/>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:DevNotes" class="hashtag"><span>#</span><span class="p-category">DevNotes</span></a> <a href="https://devblog.dinobansigan.com/tag:Bookmarks" class="hashtag"><span>#</span><span class="p-category">Bookmarks</span></a> <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:Caching" class="hashtag"><span>#</span><span class="p-category">Caching</span></a> <a href="https://devblog.dinobansigan.com/tag:HttpClient" class="hashtag"><span>#</span><span class="p-category">HttpClient</span></a> <a href="https://devblog.dinobansigan.com/tag:ReactJS" class="hashtag"><span>#</span><span class="p-category">ReactJS</span></a>  <a href="https://devblog.dinobansigan.com/tag:WindowsServices" class="hashtag"><span>#</span><span class="p-category">WindowsServices</span></a> <a href="https://devblog.dinobansigan.com/tag:SourceControlBestPractices" class="hashtag"><span>#</span><span class="p-category">SourceControlBestPractices</span></a> <a href="https://devblog.dinobansigan.com/tag:TroubleshootingWindowsProcesses" class="hashtag"><span>#</span><span class="p-category">TroubleshootingWindowsProcesses</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/devnotes-003">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/devnotes-003</guid>
      <pubDate>Mon, 26 Sep 2022 02:41:14 +0000</pubDate>
    </item>
    <item>
      <title>DevNotes - 002</title>
      <link>https://devblog.dinobansigan.com/devnotes-002?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[What is a react helmet? &#xA;&#xA;React helmet is a helper component that allows you to add data to the head section of a document or HTML page. It basically allows you to add link tags, scripts and other tags that goes into the head section of an HTML page.&#xA;&#xA;Source: What is react helmet?&#xA;&#xA;So react-helmet library didn&#39;t work for me, but this one did.&#xA;&#xA;---&#xA;&#xA;The equivalent of the npm install command in yarn is yarn without any parameters.&#xA;&#xA;---&#xA;&#xA;Was trying to help out someone on discuss.write.as get a logo to show up beside their blog title. I learned that you can actually set the size of the background image using something like background-size: 150px;. Cool stuff.&#xA;&#xA;Reference: Resizing background images with background-size&#xA;&#xA;---&#xA;&#xA;So last time I decided to just not show a header image for my Now Listening to... website on mobile screens. It was because I didn&#39;t know how to handle it. Well my easy solution turned out to be getting a smaller sized image to use as a header image. Then I was able to just add a css media screen entry that uses the smaller sized image.&#xA;&#xA;---&#xA;&#xA;Co-worker was running into Gatsby/Kentico/Grahpql errors with one of our projects. We pretty much had the same .env file and code base. Deleting the folder and downloading again didn&#39;t fix it. What worked for him was running the command npm cache clean --force. &#xA;&#xA;Note: &#xA;This is probably a dangerous command to run. Please research what it does before you try it out. I&#39;m only sharing what worked for me and my team. But this was a last resort type of attempt to fix our errors.&#xA;&#xA;---&#xA;&#xA;To create a repository from an existing folder or files using Github Desktop, first you have to create the repository on the app itself. This is so that the app can create and initialize the folder on your drive. Then you can copy over the files into the folder that the app created. And then you&#39;re set.&#xA;&#xA;---&#xA;&#xA;To copy the redirects file (or any other file for that matter) to the Output folder in Wyam, you can use the pipeline code below:&#xA;Pipelines.Add(&#xA;    // Copy redirect file to the output folder&#xA;    CopyFiles(&#34;_redirects&#34;)&#xA;);&#xA;&#xA;---&#xA;&#xA;Tags: #DevNotes #CSS #Gatsby #Github #NodeJS #ReactJS #Wyam #Yarn&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/devnotes-002&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>What is a react helmet?</p>
<ul><li>React helmet is a helper component that allows you to add data to the <code>&lt;head&gt;</code> section of a document or HTML page. It basically allows you to add <code>&lt;link&gt;</code> tags, <code>&lt;scripts&gt;</code> and other tags that goes into the <code>&lt;head&gt;</code> section of an HTML page.</li></ul>

<p>Source: <a href="https://medium.com/coding17/what-is-react-helmet-e62be15ba63b">What is react helmet?</a></p>

<p>So react-helmet library didn&#39;t work for me, but <a href="https://github.com/staylor/react-helmet-async">this one</a> did.</p>

<hr/>

<p>The equivalent of the <code>npm install</code> command in yarn is <code>yarn</code> without any parameters.</p>

<hr/>

<p>Was trying to help out someone on discuss.write.as get a logo to show up beside their blog title. I learned that you can actually set the size of the background image using something like <code>background-size: 150px;</code>. Cool stuff.</p>

<p>Reference: <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images">Resizing background images with background-size</a></p>

<hr/>

<p>So last time I decided to just not show a header image for my <a href="https://nowlisteningto.com/">Now Listening to...</a> website on mobile screens. It was because I didn&#39;t know how to handle it. Well my easy solution turned out to be getting a smaller sized image to use as a header image. Then I was able to just add a css media screen entry that uses the smaller sized image.</p>

<hr/>

<p>Co-worker was running into Gatsby/Kentico/Grahpql errors with one of our projects. We pretty much had the same <code>.env</code> file and code base. Deleting the folder and downloading again didn&#39;t fix it. What worked for him was running the command <code>npm cache clean --force</code>.</p>

<p><em>Note:
This is probably a dangerous command to run. Please research what it does before you try it out. I&#39;m only sharing what worked for me and my team. But this was a last resort type of attempt to fix our errors.</em></p>

<hr/>

<p>To create a repository from an existing folder or files using Github Desktop, first you have to create the repository on the app itself. This is so that the app can create and initialize the folder on your drive. Then you can copy over the files into the folder that the app created. And then you&#39;re set.</p>

<hr/>

<p>To copy the <code>_redirects</code> file (or any other file for that matter) to the Output folder in Wyam, you can use the pipeline code below:</p>

<pre><code class="language-csharp">Pipelines.Add(
    // Copy redirect file to the output folder
    CopyFiles(&#34;_redirects&#34;)
);
</code></pre>

<hr/>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:DevNotes" class="hashtag"><span>#</span><span class="p-category">DevNotes</span></a> <a href="https://devblog.dinobansigan.com/tag:CSS" class="hashtag"><span>#</span><span class="p-category">CSS</span></a> <a href="https://devblog.dinobansigan.com/tag:Gatsby" class="hashtag"><span>#</span><span class="p-category">Gatsby</span></a> <a href="https://devblog.dinobansigan.com/tag:Github" class="hashtag"><span>#</span><span class="p-category">Github</span></a> <a href="https://devblog.dinobansigan.com/tag:NodeJS" class="hashtag"><span>#</span><span class="p-category">NodeJS</span></a> <a href="https://devblog.dinobansigan.com/tag:ReactJS" class="hashtag"><span>#</span><span class="p-category">ReactJS</span></a> <a href="https://devblog.dinobansigan.com/tag:Wyam" class="hashtag"><span>#</span><span class="p-category">Wyam</span></a> <a href="https://devblog.dinobansigan.com/tag:Yarn" class="hashtag"><span>#</span><span class="p-category">Yarn</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/devnotes-002">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/devnotes-002</guid>
      <pubDate>Thu, 04 Aug 2022 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Passing Functions to Child Component in React</title>
      <link>https://devblog.dinobansigan.com/passing-functions-to-child-component-in-react?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[In the parent React class component, you can declare a function, that you can then pass into one of its child components. &#xA;&#xA;So say you had a Form / child component and a addNewProfile function. You can pass the function to the child component like so: &#xA;Form onSubmit={this.addNewProfile} /&#xA;&#xA;Then in the code for the Form component, you can get to the passed in function via the props object, like so:&#xA;  this.props.onSubmit(/parameters go in here/)&#xA;  &#xA;Note how React is smart enough to know that there would be an onSubmit property available in this.props. That&#39;s one of the cool things with React props.&#xA; &#xA;So anyway, passing functions into child components is basically like passing a reference to a function. It&#39;s similar to how delegates work in C# and .NET.&#xA;&#xA;Tags: #ReactJS&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/passing-functions-to-child-component-in-react&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>In the parent React class component, you can declare a function, that you can then pass into one of its child components.</p>

<p>So say you had a <code>&lt;Form /&gt;</code> child component and a <code>addNewProfile</code> function. You can pass the function to the child component like so:</p>

<pre><code class="language-js">&lt;Form onSubmit={this.addNewProfile} /&gt;
</code></pre>

<p>Then in the code for the <code>Form</code> component, you can get to the passed in function via the props object, like so:</p>

<pre><code class="language-js"> this.props.onSubmit(/*parameters go in here*/)
</code></pre>

<p>Note how React is smart enough to know that there would be an <code>onSubmit</code> property available in <code>this.props</code>. That&#39;s one of the cool things with React props.</p>

<p>So anyway, passing functions into child components is basically like passing a reference to a function. It&#39;s similar to how <a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/delegates/">delegates</a> work in C# and .NET.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:ReactJS" class="hashtag"><span>#</span><span class="p-category">ReactJS</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/passing-functions-to-child-component-in-react">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/passing-functions-to-child-component-in-react</guid>
      <pubDate>Thu, 09 Sep 2021 17:49:03 +0000</pubDate>
    </item>
    <item>
      <title>Build your first blog using React | Sanity.io</title>
      <link>https://devblog.dinobansigan.com/build-your-first-blog-using-react-sanity-io?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[This is a pretty good guide to building a blog using ReactJS and Sanity. That said, I did run into a number of issues while trying to follow it. This post is about the issues I ran into and the solutions for them.&#xA;&#xA;---&#xA;&#xA;When I got to the part where it says to run sanity init, I got errors in Visual Studio Code saying the PowerShell script is not digitally signed, so it&#39;s not allowed to run. The fix for this was to run: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force in the VS Code terminal.&#xA;&#xA;---&#xA;&#xA;Then I got the error Error: self signed certificate in certificate chain. Looked it up online and found that it seems to be caused by my VPN connection. I disconnected from my work VPN and it did resolve my issue.&#xA;&#xA;---&#xA;&#xA;I got all the way to the part of the guide where I was Building the page for all the blog posts. After following the instructions and copying the provided code into src/components/AllPosts.js , I kept running into a post.mainImage undefined error. It turns out, the provided code is expecting all posts I created in Sanity to have a main image. I had one for my first post, but didn&#39;t add one to my second post. &#xA;&#xA;The fix for the issue above was to replace img src={post.mainImage.asset.url} alt=&#34;&#34; / with  {typeof post.mainImage !== &#39;undefined&#39; &amp;&amp; img src={post.mainImage.asset.url} alt=&#34;&#34; /}. &#xA;&#xA;What that new line of code does, is check if post.mainImage is NOT undefined, and if so, render the img tag. If it was undefined, as is the case with my second post, it wouldn&#39;t render the tag, thereby avoiding the error.&#xA;&#xA;---&#xA;&#xA;After finishing the guide, I needed to figure out how to deploy the React app to Netlify. Posts online say it is as easy as dropping a Build folder into Netlify. However, there&#39;s no Build folder in sight in VS Code. Turns out, I had to run npm run build to generate the Build folder and its contents. After that, it was as easy as dropping the folder into the Netlify&#39;s deploy folder. You can find the live site on here.&#xA;&#xA;Initially the site would load, but the blog posts wouldn&#39;t show up. The fix for this was to add the site url, https://laughing-lamarr-50f7df.netlify.app, as a CORS Origins entry in my Sanity account&#39;s API settings.&#xA;&#xA;Tags: #ReactJS #Blog #Bookmarks&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/build-your-first-blog-using-react-sanity-io&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://www.sanity.io/guides/build-your-first-blog-using-react">This</a> is a pretty good guide to building a blog using <a href="https://reactjs.org/">ReactJS</a> and <a href="https://www.sanity.io/">Sanity</a>. That said, I did run into a number of issues while trying to follow it. This post is about the issues I ran into and the solutions for them.</p>

<hr/>

<p>When I got to the part where it says to run <code>sanity init</code>, I got errors in Visual Studio Code saying the PowerShell script is not digitally signed, so it&#39;s not allowed to run. The fix for this was to run: <code>Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force</code> in the VS Code terminal.</p>

<hr/>

<p>Then I got the error <code>Error: self signed certificate in certificate chain</code>. Looked it up online and found that it seems to be caused by my VPN connection. I disconnected from my work VPN and it did resolve my issue.</p>

<hr/>

<p>I got all the way to the part of the guide where I was <a href="https://www.sanity.io/guides/build-your-first-blog-using-react#building-the-page-for-all-the-blog-posts-09943e6d2b68">Building the page for all the blog posts</a>. After following the instructions and copying the provided code into <code>src/components/AllPosts.js</code> , I kept running into a <code>post.mainImage undefined</code> error. It turns out, the provided code is expecting all posts I created in Sanity to have a main image. I had one for my first post, but didn&#39;t add one to my second post.</p>

<p>The fix for the issue above was to replace <code>&lt;img src={post.mainImage.asset.url} alt=&#34;&#34; /&gt;</code> with <code>{typeof post.mainImage !== &#39;undefined&#39; &amp;&amp; &lt;img src={post.mainImage.asset.url} alt=&#34;&#34; /&gt;}</code>.</p>

<p>What that new line of code does, is check if <code>post.mainImage</code> is NOT undefined, and if so, render the <code>img</code> tag. If it was undefined, as is the case with my second post, it wouldn&#39;t render the tag, thereby avoiding the error.</p>

<hr/>

<p>After finishing the guide, I needed to figure out how to deploy the React app to Netlify. Posts online say it is as easy as dropping a Build folder into Netlify. However, there&#39;s no Build folder in sight in VS Code. Turns out, I had to run <code>npm run build</code> to generate the Build folder and its contents. After that, it was as easy as dropping the folder into the Netlify&#39;s deploy folder. You can find the live site on <a href="https://laughing-lamarr-50f7df.netlify.app/">here</a>.</p>

<p>Initially the site would load, but the blog posts wouldn&#39;t show up. The fix for this was to add the site url, <code>https://laughing-lamarr-50f7df.netlify.app</code>, as a CORS Origins entry in my Sanity account&#39;s API settings.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:ReactJS" class="hashtag"><span>#</span><span class="p-category">ReactJS</span></a> <a href="https://devblog.dinobansigan.com/tag:Blog" class="hashtag"><span>#</span><span class="p-category">Blog</span></a> <a href="https://devblog.dinobansigan.com/tag:Bookmarks" class="hashtag"><span>#</span><span class="p-category">Bookmarks</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/build-your-first-blog-using-react-sanity-io">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/build-your-first-blog-using-react-sanity-io</guid>
      <pubDate>Sun, 30 May 2021 04:54:28 +0000</pubDate>
    </item>
    <item>
      <title>DevNotes - 001</title>
      <link>https://devblog.dinobansigan.com/devnotes-001?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[Starting a new DevNotes series. This is a spin-off from my Weeknotes series. This one focuses on software development content only. This one won&#39;t exactly be a weekly thing. I&#39;ll only publish a DevNotes post when I have a number of notes to share. Otherwise I&#39;ll bundle them up into a bigger post and publish then. And with that out of the way, let&#39;s get started...&#xA;&#xA;I&#39;m starting to notice a trend with the Rust programming language. It seems to be the next big thing. Microsoft even joined the Rust Foundation. It probably should be the next language I should learn after React.&#xA;&#xA;hr class=&#34;sb&#34;/&#xA;I just realized, after installing the React Browser Dev Tools Extension, that Microsoft&#39;s Azure DevOps site was built using React. If Microsoft, who created C# and ASP.NET, uses React on their core products, it is just one more reason for me to really dig into React. &#xA;&#xA;hr class=&#34;sb&#34;/&#xA;React components can be thought of as building blocks for your website. Instead of creating a button then styling it with the primary-button CSS class, you create a PrimaryButton component then use it wherever you want.&#xA;&#xA;Reference:&#xA;Get to Know Gatsby Building Blocks&#xA;&#xA;hr class=&#34;sb&#34;/&#xA;I was building a very basic Gatsby website, the one from their tutorial. It was taking too long to build the output for a static site. Too long compared to building sites using Wyam. I don&#39;t have anything against Gatsby. In fact I&#39;m trying to learn Gatsby. I&#39;m just pointing out that it seems slow compared to Wyam.&#xA;&#xA;hr class=&#34;sb&#34;/&#xA;While going through the Gatsby tutorial, I found another alternative to Netlify for hosting static sites: Surge.&#xA;&#xA;Tags: #DevNotes #Gatsby #ReactJS #Rust #StaticSiteGenerator&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/devnotes-001&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p><em>Starting a new DevNotes series. This is a spin-off from my <a href="https://journal.dinobansigan.com/tag:Weeknotes">Weeknotes series</a>. This one focuses on software development content only. This one won&#39;t exactly be a weekly thing. I&#39;ll only publish a DevNotes post when I have a number of notes to share. Otherwise I&#39;ll bundle them up into a bigger post and publish then. And with that out of the way, let&#39;s get started...</em></p>

<p>I&#39;m starting to notice a trend with the Rust programming language. It seems to be the next big thing. <a href="https://cloudblogs.microsoft.com/opensource/2021/02/08/microsoft-joins-rust-foundation/">Microsoft even joined the Rust Foundation</a>. It probably should be the next language I should learn after React.</p>

<hr class="sb"/>

<p>I just realized, <em>after installing the React Browser Dev Tools Extension,</em> that Microsoft&#39;s Azure DevOps site was built using React. If Microsoft, who created C# and ASP.NET, uses React on their core products, it is just one more reason for me to really dig into React.</p>

<hr class="sb"/>

<p>React components can be thought of as building blocks for your website. Instead of creating a button then styling it with the <code>primary-button</code> CSS class, you create a <code>PrimaryButton</code> component then use it wherever you want.</p>

<p>Reference:
<a href="https://www.gatsbyjs.com/docs/tutorial/part-one/">Get to Know Gatsby Building Blocks</a></p>

<hr class="sb"/>

<p>I was building a very basic <a href="https://www.gatsbyjs.com/">Gatsby</a> website, the one from their tutorial. It was taking too long to build the output for a static site. Too long compared to building sites using <a href="https://wyam.io/">Wyam</a>. I don&#39;t have anything against Gatsby. In fact I&#39;m trying to learn Gatsby. I&#39;m just pointing out that it seems slow compared to Wyam.</p>

<hr class="sb"/>

<p>While going through the Gatsby tutorial, I found another alternative to Netlify for hosting static sites: <a href="https://surge.sh/">Surge</a>.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:DevNotes" class="hashtag"><span>#</span><span class="p-category">DevNotes</span></a> <a href="https://devblog.dinobansigan.com/tag:Gatsby" class="hashtag"><span>#</span><span class="p-category">Gatsby</span></a> <a href="https://devblog.dinobansigan.com/tag:ReactJS" class="hashtag"><span>#</span><span class="p-category">ReactJS</span></a> <a href="https://devblog.dinobansigan.com/tag:Rust" class="hashtag"><span>#</span><span class="p-category">Rust</span></a> <a href="https://devblog.dinobansigan.com/tag:StaticSiteGenerator" class="hashtag"><span>#</span><span class="p-category">StaticSiteGenerator</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/devnotes-001">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/devnotes-001</guid>
      <pubDate>Mon, 15 Feb 2021 04:07:13 +0000</pubDate>
    </item>
    <item>
      <title>On Learning React</title>
      <link>https://devblog.dinobansigan.com/on-learning-react?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[My first attempt at learning the React JavaScript library was by reading the ASP.NET Core 3 and React book. I started reading that book a few months ago. I&#39;ve gone through the first six chapters, which mostly covers how to build a web app front-end using React. While I did learn a lot reading those chapters, I was barely keeping up. &#xA;&#xA;There&#39;s so many new concepts, new libraries, new methods, new syntax to learn. It felt overwhelming at times. It didn&#39;t help that I kept getting distracted at the JSX syntax -- which looked insane to me at times. &#xA;&#xA;I found myself simply typing what was in the book. But I actually couldn&#39;t tell you why the code worked. I was honestly struggling to keep up. But more importantly, I was confused and frustrated at it all. Why would you even want to go through all this trouble of writing a React app? I didn&#39;t get it. And consequently, I wasn&#39;t too excited to learn more. But I had to.&#xA;&#xA;!--more--&#xA;So, after having gone through the first six chapters of the book, today I decided to take a stab at this React: Getting Started pluralsight course. And my God, what a change! &#xA;&#xA;I&#39;m actually now excited to learn more about what I can do with React. I&#39;ve only gone through the first two chapters, which are basically an introduction to React. But man what a blessing! It explained really well so much of the key concepts that I&#39;ve struggled to grasp. A lot of the confusion I had while reading the book, is now slowly starting to make sense.&#xA;&#xA;It&#39;s almost like this course is required reading, before actually reading the book.&#xA;&#xA;I now better understand props. I now better understand state management between components. I now better understand components, which is crucial if I ever want to master React. Even the JSX syntax is now starting to make sense.&#xA;&#xA;I get it now. I get why you would want to build a web app using React. I get why you would want to learn React. And now I&#39;m excited to learn more. I feel like if you want to start learning React, you should give this pluralsight course a try first. &#xA;&#xA;This is not to say that the book, ASP.NET Core 3 and React, is a bad book. It&#39;s not. It&#39;s actually very detailed and covers a lot of topics that will definitely be useful at work. It&#39;s just that I think it&#39;s too advanced for a React beginner like me. I need to get a better handle on the basics and key concepts of React, before I can fully appreciate the book.&#xA;&#xA;P.S. Apologies if this post is not as polished as other posts. I&#39;m trying to follow Joel&#39;s advice on caring less and writing more.&#xA;&#xA;Tags: #JavaScript #ReactJS&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/on-learning-react&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>My first attempt at learning the <a href="https://reactjs.org/">React</a> JavaScript library was by reading the <a href="https://www.oreilly.com/library/view/aspnet-core-3/9781789950229/">ASP.NET Core 3 and React</a> book. I started reading that book a few months ago. I&#39;ve gone through the first six chapters, which mostly covers how to build a web app front-end using React. While I did learn a lot reading those chapters, I was barely keeping up.</p>

<p>There&#39;s so many new concepts, new libraries, new methods, new syntax to learn. It felt overwhelming at times. It didn&#39;t help that I kept getting distracted at the JSX syntax — <em>which looked insane to me at times</em>.</p>

<p>I found myself simply typing what was in the book. But I actually couldn&#39;t tell you why the code worked. I was honestly struggling to keep up. But more importantly, I was confused and frustrated at it all. Why would you even want to go through all this trouble of writing a React app? I didn&#39;t get it. And consequently, I wasn&#39;t too excited to learn more. But I had to.</p>



<p>So, after having gone through the first six chapters of the book, today I decided to take a stab at this <a href="https://www.pluralsight.com/courses/react-js-getting-started">React: Getting Started</a> pluralsight course. And my God, what a change!</p>

<p>I&#39;m actually now excited to learn more about what I can do with React. I&#39;ve only gone through the first two chapters, which are basically an introduction to React. But man what a blessing! It explained really well so much of the key concepts that I&#39;ve struggled to grasp. A lot of the confusion I had while reading the book, is now slowly starting to make sense.</p>

<p><em>It&#39;s almost like this course is required reading, before actually reading the book.</em></p>

<p>I now better understand props. I now better understand state management between components. I now better understand components, which is crucial if I ever want to master React. Even the JSX syntax is now starting to make sense.</p>

<p>I get it now. I get why you would want to build a web app using React. I get why you would want to learn React. And now I&#39;m excited to learn more. I feel like if you want to start learning React, you should give this pluralsight course a try first.</p>

<p>This is not to say that the book, ASP.NET Core 3 and React, is a bad book. It&#39;s not. It&#39;s actually very detailed and covers a lot of topics that will definitely be useful at work. It&#39;s just that I think it&#39;s too advanced for a React beginner like me. I need to get a better handle on the basics and key concepts of React, before I can fully appreciate the book.</p>

<p><em>P.S. Apologies if this post is not as polished as other posts. I&#39;m trying to follow Joel&#39;s advice <a href="https://joelhooks.com/on-writing-more">on caring less and writing more</a>.</em></p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:JavaScript" class="hashtag"><span>#</span><span class="p-category">JavaScript</span></a> <a href="https://devblog.dinobansigan.com/tag:ReactJS" class="hashtag"><span>#</span><span class="p-category">ReactJS</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/on-learning-react">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/on-learning-react</guid>
      <pubDate>Fri, 05 Feb 2021 06:38:15 +0000</pubDate>
    </item>
  </channel>
</rss>