<?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>Forem: Mekarosi</title>
    <description>The latest articles on Forem by Mekarosi (@mekarosi).</description>
    <link>https://forem.com/mekarosi</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%2F243753%2F5114db36-21e6-4f0d-8c68-a136bf07b81f.jpeg</url>
      <title>Forem: Mekarosi</title>
      <link>https://forem.com/mekarosi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mekarosi"/>
    <language>en</language>
    <item>
      <title>Create a Rails app with React for frontend using Esbuild and Jsbundle</title>
      <dc:creator>Mekarosi</dc:creator>
      <pubDate>Fri, 18 Nov 2022 13:15:36 +0000</pubDate>
      <link>https://forem.com/mekarosi/create-a-rails-app-with-react-for-frontend-using-esbuild-and-jsbundle-15a</link>
      <guid>https://forem.com/mekarosi/create-a-rails-app-with-react-for-frontend-using-esbuild-and-jsbundle-15a</guid>
      <description>&lt;p&gt;This post explains how I use esbuild and jsbundling to integrate a Rails 7 application with React.js as the frontend.&lt;br&gt;
I use esbuild as my JavaScript bundler, but you may also use Webpack or rollup.js.&lt;br&gt;
I'll describe the steps I followed, as well as the bugs I encountered and how I fixed them.&lt;br&gt;
I'll be using the following versions: Ruby 3.1.2, Rails 7.0.4, and React 18.2.0 for this setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1
&lt;/h3&gt;

&lt;p&gt;I created a new rails app called reactapp and included j and esbuild flags.&lt;/p&gt;

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

rails new reactapp -j esbuild



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

&lt;/div&gt;

&lt;p&gt;Then I run the following code to launch Rails server.&lt;/p&gt;

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

run rails server



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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Step 2
&lt;/h3&gt;

&lt;p&gt;You can see the commands for simultaneously running the JavaScript files and the Rails server in your Procfile.dev  file.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

// To run rails server and Javascript files simultaneously

web: bin/rails server -p 3000



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

&lt;/div&gt;

&lt;p&gt;But you may also use the following codes to run them independently on different terminals.&lt;/p&gt;

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

// To run only Javascript files

yarn build --watch



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

&lt;/div&gt;

&lt;p&gt;and &lt;/p&gt;

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

//To run only rails server

rails server



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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;p&gt;After running my rails server and JavaScript files, I encountered a bug as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4za00kber2wv6akhxnf8.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4za00kber2wv6akhxnf8.PNG" alt="Server Error"&gt;&lt;/a&gt;&lt;br&gt;
To debug the error I changed my package.json file as shown below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0miju1hegpj6zx37wo6c.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0miju1hegpj6zx37wo6c.PNG" alt="Solution to server error above"&gt;&lt;/a&gt;&lt;br&gt;
Note that you may probably not encounter this bug.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 4
&lt;/h3&gt;

&lt;p&gt;I utilize stimulus to create a controller for my react setup by executing the code below since stimulus have been added to the Gemfile during initial setup in step 1 above.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

rails g stimulus react



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

&lt;/div&gt;

&lt;p&gt;The react controller.js file was generated by running the code above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5
&lt;/h3&gt;

&lt;p&gt;The newly created react_controller.js file is as shown below&lt;/p&gt;

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

import { Controller } from "@hotwired/stimulus"

// Connects to data-controller="react"
export default class extends Controller {
  connect() {
  }
}


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Step 6
&lt;/h3&gt;

&lt;p&gt;Now I run the code below to create my home page.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

rails g controller pages home



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

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6zyonud1o764qcx3p6wl.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6zyonud1o764qcx3p6wl.PNG" alt="Creating home page code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7
&lt;/h3&gt;

&lt;p&gt;In the &lt;strong&gt;routes.rb&lt;/strong&gt; file, I added the below code to create my home page route.&lt;/p&gt;

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

root 'pages#home'



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

&lt;/div&gt;

&lt;p&gt;My routes.rb file is now as displayed below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0pvhht9rcfvai9lwq36.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0pvhht9rcfvai9lwq36.PNG" alt="routes.rb file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 8
&lt;/h3&gt;

&lt;p&gt;In the &lt;strong&gt;home.html.erb&lt;/strong&gt; file I added the following code&lt;/p&gt;

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

  &amp;lt;%= content_tag(:div, "",
 id:"app", data: {
    controller: "react"
 })%&amp;gt;



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

&lt;/div&gt;

&lt;p&gt;Now the &lt;strong&gt;home.html.erb&lt;/strong&gt; file is as seen below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ue38a7acyct1z22in7r.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ue38a7acyct1z22in7r.PNG" alt="home.html.erb file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep in mind that the name of your controller should match the name of the stimulus you created in step 4 above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 9
&lt;/h3&gt;

&lt;p&gt;In the react_controller.js file I console log "react controller connected" to test if my JavaScript files are connecting with my rails application&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3z3mn1vstmtuab8xwphy.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3z3mn1vstmtuab8xwphy.PNG" alt="react_controller.js file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, You may encounter an error when you run rails server as I did below,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7npzi67slxkwfvk2es2.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7npzi67slxkwfvk2es2.PNG" alt="encountered error when run rails server"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run Rails Server from your Windows command prompt to fix the aforementioned error. For me, it fixed the issue as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft923kv3wnzktngt3buvq.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft923kv3wnzktngt3buvq.PNG" alt="solved error "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the console you can see "react controller connected" indicating that JavaScript is running and connecting to rails. &lt;/p&gt;

&lt;h3&gt;
  
  
  Step 10
&lt;/h3&gt;

&lt;p&gt;Let's now add some react components. First, I ran the code below to add react and react-dom packages to the application.&lt;/p&gt;

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

yarn add react react-dom


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

&lt;/div&gt;

&lt;p&gt;In the package.json file, you can see react and react-dom have been included.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqrqkwxu2xtrobgjab4y4.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqrqkwxu2xtrobgjab4y4.PNG" alt="The package.json file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 11
&lt;/h3&gt;

&lt;p&gt;Now I created App.js file in app/javascript/controllers folder&lt;br&gt;
as seen below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsh5nbbntrrlkbq4avz3a.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsh5nbbntrrlkbq4avz3a.PNG" alt="The App.js file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 12
&lt;/h3&gt;

&lt;p&gt;In the &lt;strong&gt;react_controller.js&lt;/strong&gt; file I imported App.js, react and react-dom and then added the following code below&lt;/p&gt;

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

 const root = ReactDOM.createRoot(document.getElementById("app"))
     root.render(
      &amp;lt;App/&amp;gt; 
     )


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

&lt;/div&gt;

&lt;p&gt;Now the &lt;strong&gt;App.js&lt;/strong&gt; file is as seen below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0m4tlrfngqqhw9819ov.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0m4tlrfngqqhw9819ov.PNG" alt="The App.js file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 13
&lt;/h3&gt;

&lt;p&gt;When I ran my JavaScript file using the code in step 2 above, I got the error you can see below after creating the App.js file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8fhheaydzan5b6uehho3.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8fhheaydzan5b6uehho3.PNG" alt="Error after creating App.js"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To solve the above error I added "--loader:.js=jsx" to the package.json script as seen below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxickqn40l9x8f9ft5t25.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxickqn40l9x8f9ft5t25.PNG" alt="the package.json"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My App.js file is now rendered in the browser as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxd6sa4h9of5vae91gf3y.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxd6sa4h9of5vae91gf3y.PNG" alt="App.js file rendered on the browser"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 14
&lt;/h3&gt;

&lt;p&gt;Let's create two components . First, I added react-router-dom package to the application and  then create the clock.js and count.js components as seen in the images below&lt;/p&gt;

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

yarn add react-router-dom


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

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq81uzk8ai6iljhoyfv39.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq81uzk8ai6iljhoyfv39.PNG" alt="count component"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsaber3yljg2gcscjvgf3.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsaber3yljg2gcscjvgf3.PNG" alt="clock component"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 15
&lt;/h3&gt;

&lt;p&gt;In the &lt;strong&gt;App.js&lt;/strong&gt; file I imported clock.js, count.js and react-router-dom. As seen below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feyxx72a9nw1o0bf718ov.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feyxx72a9nw1o0bf718ov.PNG" alt="App.js file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 16
&lt;/h3&gt;

&lt;p&gt;To create routes for the two newly created components, I added the following code to the routes.rb file.&lt;/p&gt;

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

get '*path', to: 'pages#home', via: :all 


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

&lt;/div&gt;

&lt;p&gt;As seen below, my two components have now been rendered and are viewable in the browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4xrwr05sh0qsxs24owz.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4xrwr05sh0qsxs24owz.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4zozj7gbwjayimywi16.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4zozj7gbwjayimywi16.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 17
&lt;/h3&gt;

&lt;p&gt;Now I used react hooks for state update and useEffect for side effects. As seen below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F040ljpq4gf56e6i71o7j.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F040ljpq4gf56e6i71o7j.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd57xy7norq2u48ws5h5s.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd57xy7norq2u48ws5h5s.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, I've provided the GitHub repository for the tutorial I described above, on &lt;a href="https://github.com/Mekarosi/reactapp" rel="noopener noreferrer"&gt;how I used esbuild and Jsbundle to connect rails and React&lt;/a&gt; . I hope this tutorial will be useful to someone. Thanks for reading.&lt;/p&gt;

</description>
      <category>react</category>
      <category>ruby</category>
      <category>rails</category>
      <category>esbuild</category>
    </item>
    <item>
      <title>Intersection of Coding and Culture</title>
      <dc:creator>Mekarosi</dc:creator>
      <pubDate>Fri, 28 Jan 2022 15:42:28 +0000</pubDate>
      <link>https://forem.com/mekarosi/intersection-of-coding-and-culture-4nf4</link>
      <guid>https://forem.com/mekarosi/intersection-of-coding-and-culture-4nf4</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3umfq4fk3b37ow677gv.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3umfq4fk3b37ow677gv.JPG" alt="cover_image" title="artificial-intelligence-judged-a-beauty-contest" width="599" height="416"&gt;&lt;/a&gt;&lt;br&gt;
This photo is from a beauty pageant contest in which artificial intelligence was used to award the most beautiful lady; needless to say, the factors influencing the award will be dependent on the data collected to build the AI, based on the cultural schema of those that created the AI.&lt;/p&gt;

&lt;p&gt;Dominant cultures embedded in our technologies, unfortunately, enforces certain beauty standards, so when technologies are not representative of as many cultures as possible this causes harm in different areas of life. &lt;/p&gt;

&lt;p&gt;I recently attended a &lt;a href="https://sip.scratch.mit.edu/sec/"&gt;Scratch Education Collaborative&lt;/a&gt; workshop as a volunteer with &lt;a href="https://www.teachathonetwork.com/coverpage"&gt;Teachathon Foundation&lt;/a&gt;; the workshop was about connecting culture, coding, and equity.&lt;/p&gt;

&lt;p&gt;I like to share my thought regarding the intersection of culture and coding. &lt;/p&gt;

&lt;p&gt;Firstly, let's understand how culture impacts our coding creativity. We acknowledge it or not culture is reflected, in lots of ways, shaping how we talk, think, and even how we code. &lt;/p&gt;

&lt;p&gt;Culture is the software to the brain's hardware, like without software, the computer will be a hunk of metal, but once the software is open and engaged the computer knows what to do.&lt;/p&gt;

&lt;p&gt;Culture is the norm, behaviors, and beliefs that bind a group together. Our brains have been collecting and connecting information through the lens of culture since birth. Culture is the network that connects information. &lt;/p&gt;

&lt;p&gt;On the other hand, coding is communication with the computer and getting back a response. Coding is how we take things that are important to people, add innovations to them, and get them to provide value to the wider audiences in the form of software, website, applications, robots, AI, etc.&lt;/p&gt;

&lt;p&gt;As programmers when we create content, design software, collect data, develop an algorithm and create emoji, unconsciously our cultural schema is reflected in all these things that we do. Cultural schema is how the brain organizes information and forms a collection of everything we know. &lt;/p&gt;

&lt;p&gt;To illustrate, when creating an emoji for the word "OK" this may be done differently by as many designers, based on their cultural schema. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypcfdn469rym981as0p5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypcfdn469rym981as0p5.jpg" alt="people-looking-at-smartphones" title="people-looking-at-smartphones" width="640" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Culture and code are at a crossroads. In the space of creative computing, the way we create is either positioned to be neutral or sometimes can lean toward certain biases. Some current or immerging technologies are not necessarily representative of everyone's culture. They can often hold dominant culture, that’s why everyone must participate in creating and shaping technology. &lt;/p&gt;

&lt;p&gt;Programmers should, in authentic ways, make sure that they tap into their cultural schema and identities when designing and creating technologies, thus ensuring that diverse cultures are represented rather than one or two dominant cultures been represented.  &lt;/p&gt;

&lt;p&gt;In conclusion, making sure everyone is participating and represented in shaping technology is a way to create a balance for fairness, originality, and equity.  When some are not culturally acceptable or represented, the balance is tilted. &lt;/p&gt;

&lt;p&gt;I believe the following ways can effectively intersect culture and coding &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decentralize dominant culture with coding creativity.&lt;/li&gt;
&lt;li&gt;Creating technologies that opposes cultural biases.&lt;/li&gt;
&lt;li&gt;Teaching learners to embrace others cultural beliefs.&lt;/li&gt;
&lt;li&gt;Encourage coding creativity and cultural acceptance.&lt;/li&gt;
&lt;li&gt;Bridging culture interferences in coding.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Understanding JavaScript Methods as an Absolute Beginner</title>
      <dc:creator>Mekarosi</dc:creator>
      <pubDate>Sun, 16 Jan 2022 17:40:45 +0000</pubDate>
      <link>https://forem.com/mekarosi/understanding-javascript-methods-as-an-absolute-beginner-56k1</link>
      <guid>https://forem.com/mekarosi/understanding-javascript-methods-as-an-absolute-beginner-56k1</guid>
      <description>&lt;p&gt;As an absolute beginner, having learned and understood the syntax of a programming language, the next step is to understand how to use the &lt;strong&gt;“methods”&lt;/strong&gt; of the language. I like to think of methods as the vocabulary of a language, the more you understand the easier it is to communicate and write code effectively. &lt;/p&gt;

&lt;h4&gt;
  
  
  What are methods?
&lt;/h4&gt;

&lt;p&gt;Methods are &lt;a href="https://www.w3schools.com/js/js_functions.asp"&gt;functions&lt;/a&gt; which is a &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/property"&gt;property&lt;/a&gt; of an &lt;strong&gt;object&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Ok,  What are objects?&lt;/p&gt;

&lt;p&gt;In JavaScript, objects can be seen as a collection of properties. Objects usually contains key/value pairs wrapped in an opening and closing curly brackets, as seen below.&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;let&lt;/span&gt; &lt;span class="nx"&gt;person&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;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;fullName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&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;lastName&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;span class="c1"&gt;// person is the name of the object&lt;/span&gt;
&lt;span class="c1"&gt;// firstName, lastName and fullName are the keys&lt;/span&gt;
&lt;span class="c1"&gt;// John, Doe, the function are the corresponding values&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's understand what are &lt;strong&gt;methods&lt;/strong&gt;? &lt;/p&gt;

&lt;p&gt;The below lines of code shows an object containing a function. The object name is "objectName" and the &lt;strong&gt;method&lt;/strong&gt; is "methodName".&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;objectName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;methodName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Logics to be executed are written&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// methodName is a method of this object - called objectName.&lt;/span&gt;
&lt;span class="c1"&gt;// methodName is a function which is a property of the object.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Methods are the block of codes or statements in a program that gives the user the ability to &lt;strong&gt;reuse&lt;/strong&gt; the same code which ultimately saves the excessive use of memory, acts as a &lt;strong&gt;time saver&lt;/strong&gt; and more importantly, it provides a better &lt;strong&gt;readability&lt;/strong&gt; of code. So basically, a method is a collection of statements that perform some specific task and returns the result to the caller. A method can also perform some specific task without returning anything.&lt;/p&gt;

&lt;h4&gt;
  
  
  Accessing Methods
&lt;/h4&gt;

&lt;p&gt;JavaScript provides two notations for accessing methods. The first, and most common, is known as &lt;strong&gt;dot notation&lt;/strong&gt;. Under dot notation, a method is accessed by giving the object name, followed by a period (or dot), followed by the property name.&lt;/p&gt;

&lt;h4&gt;
  
  
  Dot Notation
&lt;/h4&gt;

&lt;p&gt;You can access an object method using a dot notation. The syntax is:&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;object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;methodName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello world&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="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// To access the method using dot notation.&lt;/span&gt;
&lt;span class="nx"&gt;object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;methodName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;//  hello world&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Here, the methodName method is accessed as &lt;strong&gt;object.methodName()&lt;/strong&gt; &lt;br&gt;
If you access a method without the () parentheses, it will return the function definition, to execute a function we invoke the function with ().&lt;/p&gt;
&lt;h4&gt;
  
  
  Bracket Notation
&lt;/h4&gt;

&lt;p&gt;The second method is the &lt;strong&gt;bracket notation&lt;/strong&gt;. For the bracket notation, a method is accessed by giving the object name, followed by the property name in quotation and then wrapped in an opening and closing square bracket.&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;objectName&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;propertyName&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;Note that in the code below, the quotations are absence, this is because the object properties has been assigned to a variable.&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;let&lt;/span&gt; &lt;span class="nx"&gt;propertyName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;property&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;objectName&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;propertyName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

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

&lt;/div&gt;



&lt;h4&gt;
  
  
  Difference between Methods and Functions in JavaScript
&lt;/h4&gt;

&lt;p&gt;We often misplace methods as functions; now let’s try to understand the difference between Method and function in JavaScript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Methods:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A JavaScript method is a property of an object that contains a function definition. Methods are functions stored as object properties. Method can be accessed with the following syntax:&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;object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;methodName&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;Features of Methods:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Actions that can be performed on objects are what we term JavaScript methods.&lt;/li&gt;
&lt;li&gt;The method can also be called without using parenthesis.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Functions:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;A function is a block of code written to perform some specific set of tasks. We can define a function using the &lt;em&gt;function keyword&lt;/em&gt;, followed by &lt;em&gt;Name&lt;/em&gt; and optional &lt;em&gt;parameters&lt;/em&gt;. Body of function is enclosed in Curly braces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Function syntax:&lt;/strong&gt;&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;// Function keyword&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="c1"&gt;// Code to be executed&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="c1"&gt;// Arrow function&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;functionName&lt;/span&gt; &lt;span class="o"&gt;=&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="c1"&gt;// Code to be executed&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;Features of Functions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The function is executed when something calls/invokes it.&lt;/li&gt;
&lt;li&gt;The name may contain letters, digits, dollar signs, underscore.&lt;/li&gt;
&lt;li&gt;Parameters are listed inside round parenthesis after the name of the function.&lt;/li&gt;
&lt;li&gt;Arguments are values a function receives when it is invoked.&lt;/li&gt;
&lt;li&gt;When the control reaches the return statement, it will stop executing and the value is returned to the caller.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Built-In JavaScript Methods
&lt;/h4&gt;

&lt;p&gt;Built-in methods are predefined pieces of code in a program or programming framework or a programming language that performs some specific task. This makes programming easy as programmers don’t have to create a new method or function and can simply directly use the built-in methods in their application. &lt;/p&gt;

&lt;h4&gt;
  
  
  Some JavaScript Built-In Methods are as follow:
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.w3schools.com/jsref/jsref_obj_array.asp"&gt;Array Methods&lt;/a&gt;&lt;/strong&gt;: Array methods are functions built-in to JavaScript that we can apply to arrays.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.w3schools.com/jsref/jsref_obj_string.asp"&gt;String Methods&lt;/a&gt;&lt;/strong&gt;: String methods help you to work with strings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object"&gt;Object Methods&lt;/a&gt;&lt;/strong&gt;: Object methods help you to work with strings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date"&gt;Date Methods&lt;/a&gt;&lt;/strong&gt;: Date methods allow you to get and set the year, month, day, hour, minute, second, and millisecond of date objects, using either local time or UTC (universal, or GMT) time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.studytonight.com/javascript/javascript-document-object"&gt;Document Object Methods&lt;/a&gt;&lt;/strong&gt;: JavaScript Document object is an object that provides access to all HTML elements of a document.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number"&gt;Number Methods&lt;/a&gt;&lt;/strong&gt;:The Number object contains only the default methods that are part of every object's definition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math"&gt;Math Method&lt;/a&gt;&lt;/strong&gt;: Math is a built-in object that has properties and methods for mathematical constants and functions. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.w3schools.com/jsref/obj_window.asp"&gt;Window Object Method&lt;/a&gt;&lt;/strong&gt;: The window object represents an open window in a browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions"&gt;RegExp Methods&lt;/a&gt;&lt;/strong&gt;: Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. These patterns are used with the exec() and test() methods of RegExp, and with the match(), matchAll(), replace(), replaceAll(), search(), and split() methods of String. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>LEARN TO CODE AS AN ABSOLUTE BEGINNER</title>
      <dc:creator>Mekarosi</dc:creator>
      <pubDate>Sat, 07 Aug 2021 22:30:25 +0000</pubDate>
      <link>https://forem.com/mekarosi/learn-to-code-as-an-absolute-beginner-4om3</link>
      <guid>https://forem.com/mekarosi/learn-to-code-as-an-absolute-beginner-4om3</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v76Fs4fL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://images.pexels.com/photos/2740956/pexels-photo-2740956.jpeg%3Fauto%3Dcompress%26cs%3Dtinysrgb%26h%3D2500%26w%3D3260" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v76Fs4fL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://images.pexels.com/photos/2740956/pexels-photo-2740956.jpeg%3Fauto%3Dcompress%26cs%3Dtinysrgb%26h%3D2500%26w%3D3260" alt="Black and White Laptop" title="Photo by Prateek Katyal from Pexels" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was fortunate to have a mentor guiding me and pointing out the pitfalls while learning to code. At that time, I was tempted to believe that I could learn to code in 3 months and become proficient. However, the truth is learning a programming language is similar to learning any human language, such that you have to start by learning the ABC (alphabets), syntax, and logic.&lt;/p&gt;

&lt;p&gt;Most beginners usually believe that learning to code is a piece of cake. They glance through it and assume that is the best method.&lt;br&gt;
It has been four years since learning to code, and I have realized that there are steps to follow to make the learning process easier and faster without getting overwhelmed.&lt;/p&gt;

&lt;p&gt;Deliberate practice and often guided by an expert skilled coach or mentor (someone with an expert eye), according to bestselling author Daniel Golemon, these coaches and mentors are offering feedback in specific ways to improve and without such feedback, you don’t get to the top ranks. This feedback matters and your concentration does too, not just the hours. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ways to mastery&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;• The best way to get better at something is through deliberate practice, which means practicing to get better, doing activities recommended by experts to develop specific abilities, identifying weaknesses and working to correct them, and intentionally pushing yourself out of your comfort zone.&lt;/p&gt;

&lt;p&gt;• Learn by studying experienced developers’ well-written codes and understanding what output every line of code is giving.&lt;/p&gt;

&lt;p&gt;• Do not forget that what you think often stays in your memory. For each line of code you learn, reminisce on it continuously.&lt;/p&gt;

&lt;p&gt;I have always loved using computers since a young age, so I loved and embraced the idea of learning to code. I started learning to code four years ago. Thus far, I have realized that learning a programming language is literally like learning any human language like French, Yoruba, or English. &lt;/p&gt;

&lt;p&gt;We all know &lt;strong&gt;&lt;em&gt;coding is simply using the syntax of a programming language to communicate with the computer, to output a given instruction.&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;For a beginner, coding can be overwhelming, frustrating, and intimidating especially, if you are not patient and highly interested. However, while learning how to code, I figured out there are some stages to follow to make your learning curve faster and seamless.&lt;/p&gt;

&lt;p&gt;I have highlighted below, stages I followed that have helped me while going through my coding journey.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Stages in learning to code&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6j8gxcf8ep1ivdex9gj.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6j8gxcf8ep1ivdex9gj.JPG" alt="man on progress ladder" title="Man on progress ladder" width="462" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;STAGE 1&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Syntax stage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Start by learning the syntax of the programming language. Languages have their syntax, which is the fundamental of any language. &lt;/p&gt;

&lt;p&gt;This stage is of importance because it will help you understand the basics of the language.&lt;/p&gt;

&lt;p&gt;There are tons of sites online that you can use to learn the syntax of any programming language of your interest.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;STAGE 2&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Algorithm/problem-solving stage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;The algorithm/problem-solving stage is the stage where you use the syntax you have learned to write an algorithm to solve problems. This stage is aimed at improving your logical thinking skills, mathematical skills, and problem-solving skills.&lt;/p&gt;

&lt;p&gt;Some resources that helped me at this stage were&lt;/p&gt;

&lt;p&gt;• &lt;a href="https://www.freecodecamp.org/"&gt;Free Code Camp&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;• &lt;a href="https://www.khanacademy.org/computing/computer-programming"&gt;Khan Academy&lt;/a&gt; &lt;br&gt;
• &lt;a href="https://www.w3schools.com/"&gt;W3Schools&lt;/a&gt;&lt;br&gt;
• &lt;a href="https://upskillcourses.com/"&gt;Upskill&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;• &lt;a href="https://www.codecademy.com/"&gt;Code Academy&lt;/a&gt;&lt;br&gt;
• &lt;a href="https://www.udemy.com/courses/development/web-development/"&gt;Udemy&lt;/a&gt;&lt;br&gt;
• &lt;a href="https://www.codewars.com/"&gt;Codewars&lt;/a&gt;&lt;br&gt;
• &lt;a href="https://www.codeconquest.com/"&gt;Code Conquest&lt;/a&gt;&lt;br&gt;
• &lt;a href="https://www.theodinproject.com/"&gt;The Odin Project&lt;/a&gt;&lt;br&gt;
• &lt;a href="https://www.codeavengers.com/"&gt;Code Avengers&lt;/a&gt;&lt;br&gt;
• &lt;a href="https://www.coursera.org/"&gt;Coursera&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;STAGE 3&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Tools stage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;The tools stage is the stage where you start to learn how to use important tools that are necessary to the code learning process. Some of these tools are&lt;/p&gt;

&lt;p&gt;• Debugging tools &lt;br&gt;
• Code editors&lt;br&gt;
• Version control tools e.g. Git&lt;br&gt;
• GitHub and GitLab etc.&lt;br&gt;
• Chrome Inspect tool&lt;br&gt;
• Deployment tools/platforms (Heroku, Netlify) etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iIwm148E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://images.pexels.com/photos/6330644/pexels-photo-6330644.jpeg%3Fauto%3Dcompress%26cs%3Dtinysrgb%26dpr%3D2%26h%3D1950%26w%3D3540" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iIwm148E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://images.pexels.com/photos/6330644/pexels-photo-6330644.jpeg%3Fauto%3Dcompress%26cs%3Dtinysrgb%26dpr%3D2%26h%3D1950%26w%3D3540" alt="person coding on laptop" title="Photo by Mati Mango from Pexels" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;STAGE 4&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Technique stage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;The Technique stage is where you learn techniques that are important to the programming language you are learning. &lt;/p&gt;

&lt;p&gt;Some of these techniques are&lt;/p&gt;

&lt;p&gt;• OOP (Object Orient Programming)&lt;br&gt;
• Variables&lt;br&gt;
• Methods&lt;br&gt;
• Functions&lt;br&gt;
• Higher order functions/closure/promise etc.&lt;br&gt;
• Array or Lists&lt;br&gt;
• If/Else statements&lt;br&gt;
• Loops&lt;br&gt;
• Classes and objects&lt;br&gt;
• Exception handling&lt;br&gt;
• REST Model (http methods/verbs)&lt;br&gt;
• MVC Models&lt;br&gt;
• Data Structures&lt;br&gt;
• Trees, maps, and more.&lt;br&gt;
• Frameworks like: bootstrap, tailwinds, node.js, react.js, Django, Flask, and Rails etc.&lt;/p&gt;

&lt;p&gt;This is the barrier to entry stage and a lot of patience and persistence is required because there are lots to be learnt at this stage.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;STAGE 5&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Read to understand stage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;“Read to understand stage” is the stage where you should read and understand documentation and also understand how other developers write their codes. At this stage, you can start applying all you have learned so far to continue to improve your understanding of the programming language.&lt;/p&gt;

&lt;p&gt;Some ways to learning at this stage are by using&lt;/p&gt;

&lt;p&gt;• Medium&lt;br&gt;
• Stack overflow&lt;br&gt;
• Programming Documentations and write-ups&lt;br&gt;
• Framework Documentations etc.&lt;/p&gt;

&lt;p&gt;You will also understand more about the industry, how things are done, the latest trends, and how things evolve in the industry at this stage. &lt;/p&gt;

&lt;p&gt;Your ability to keep yourself up to date about the industry will improve at this stage.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;STAGE 6&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Implementation Stage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;The implementation stage is the stage where you implement and apply all you have been learning. At this stage, you can recreate other people's well-written codes and apps. This stage will help you solidify all you have learned so far and also improve your debugging skills. More so, you can at this stage figure out which of the stage you need to improve on.&lt;/p&gt;

&lt;p&gt;YouTube video tutorials could be helpful at this stage. &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;STAGE 7&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Create Stage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;At the “Create Stage”, you learn by creating simple apps, using all you have learned thus far, you could create simple apps like  &lt;/p&gt;

&lt;p&gt;• TODO app&lt;br&gt;
• Weather app&lt;br&gt;
• Calculator app&lt;br&gt;
• Your portfolio etc.&lt;/p&gt;

&lt;p&gt;This is the stage where you get your feet wet and start using learned skills and tools. Lots of logical thinking is required at this stage.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;STAGE 8&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Practice Stage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;The Practice stage is where you continue to practice and add more features to your created apps and expanding your coding skills. At this stage, most people get tempted to rush into learning another programming language, but I strongly suggest, keep practicing and immerse yourself into the programming language you have been learning otherwise, you stand the chance of completely forgetting all you have learned.&lt;/p&gt;

&lt;p&gt;At this stage, it is advisable to collaborate with other developers ( &lt;a href="https://chingu.io/"&gt;Chingu.io&lt;/a&gt;  provides a great avenue to collaboration) to further sharpen your communication and collaboration skills. Also, don’t be afraid of criticism because it will help to your betterment.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;STAGE 9&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Internship Stage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;To completely immerse yourself into understanding how to code, the internship stage will help you understand the real-life applications of your whole learning process. At this stage, you start building up your technical experience in the working environment.&lt;/p&gt;

&lt;p&gt;You will learn to follow standards and best practices. And more so, learn to work with scheduled timing to completing apps.&lt;/p&gt;

&lt;p&gt;Tools like&lt;br&gt;
• &lt;a href="https://www.atlassian.com/software/jira"&gt;JIRA&lt;/a&gt;&lt;br&gt;
• &lt;a href="https://taskablehq.com/"&gt;ASANA&lt;/a&gt;   &lt;/p&gt;

&lt;p&gt;maybe necessary to help meet deadlines.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Generally, learning any skill requires deliberate effort to attain mastery. I must mention these are the stages I followed to learning to code, and as always, there are different possible ways to getting things done. The stages named above helped me become a better software developer. &lt;/p&gt;

&lt;p&gt;As a coding instructor, teaching others has also helped to improve my coding skills.&lt;/p&gt;

&lt;p&gt;Hopefully, this write-up could help someone learn to code as an absolute beginner without becoming overwhelmed and frustrated.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>career</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
