<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Walktheworld</title>
    <description>The latest articles on DEV Community by Walktheworld (@walktheworld).</description>
    <link>https://dev.to/walktheworld</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%2F617568%2Fdae0a15a-a3eb-426a-9239-a6e70d3a56be.png</url>
      <title>DEV Community: Walktheworld</title>
      <link>https://dev.to/walktheworld</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/walktheworld"/>
    <language>en</language>
    <item>
      <title>How to display your react card components as a grid</title>
      <dc:creator>Walktheworld</dc:creator>
      <pubDate>Thu, 21 Jul 2022 23:24:26 +0000</pubDate>
      <link>https://dev.to/walktheworld/how-to-display-your-react-card-components-as-a-grid-1bm4</link>
      <guid>https://dev.to/walktheworld/how-to-display-your-react-card-components-as-a-grid-1bm4</guid>
      <description>&lt;p&gt;I am working through my software engineering program and there is not a lot of focus on the styling side of things. So I attempted to teach myself how to display my react applications in grid form for my projects. I found there are a lot of fancy customizations you can do in grid formatting. But let's talk about some basics. &lt;/p&gt;

&lt;p&gt;When using styled-components, we can do the styling right on the &lt;code&gt;PageList.js&lt;/code&gt; file.  We define Wrapper as a styled-component and in there we will use our CSS formatting to get the grid.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import PageCard from "./PageCard"
import styled from "styled-components";

const PageList = ({pages, user}) =&amp;gt; {
  const renderPages = pages?.map(page =&amp;gt; &amp;lt;PageCard key={page.id} page={page} user={user} /&amp;gt;)
    return (
      &amp;lt;Wrapper&amp;gt;{renderPages}&amp;lt;/Wrapper&amp;gt;
       )
}  
 const Wrapper = styled.section`
  display: grid ;
  grid-template-columns: auto auto auto;
  grid-gap: .5rem;
`;

export default PageList
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we map through each Page and we render it within our &lt;code&gt;Wrapper&lt;/code&gt; component. By setting our &lt;code&gt;grid-template-columns&lt;/code&gt; as "&lt;code&gt;auto auto auto&lt;/code&gt;" that will set the grid as three columns wide. If we set it to "&lt;code&gt;auto auto&lt;/code&gt;" that will make it two columns wide. I prefer the auto formatting but if you would like them at fixed widths just use your CSS tools to set those widths.&lt;/p&gt;

&lt;p&gt;That same code works in a CSS file if you prefer styling through a single file. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;Thanks for coming to my DEV talk, Happy Coding!&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Basics of Custom Routes in Rails</title>
      <dc:creator>Walktheworld</dc:creator>
      <pubDate>Wed, 20 Jul 2022 00:10:18 +0000</pubDate>
      <link>https://dev.to/walktheworld/basics-of-custom-routes-in-rails-9in</link>
      <guid>https://dev.to/walktheworld/basics-of-custom-routes-in-rails-9in</guid>
      <description>&lt;p&gt;I am working on a project for my software engineering program. I was required to include a custom route to display some info on a profile page. So here is a little bit on how to build a custom route in a React/Rails Application.  &lt;/p&gt;

&lt;p&gt;We don't need to do this in any particular order, but the bridge between the frontend and the backend are the routes so let's start there. So we define profile in our &lt;code&gt;routes.rb&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rails.application.routes.draw do
  namespace :api do
    get "/users", to: "users#index"
    post "/signup", to: "users#create"
    get "/me", to: "users#show"
    post "/login", to: "sessions#create"
    delete "/logout", to: "sessions#destroy"
    get "/profile", to: "users#profile"

    resources :breweries do
      resources :reviews, shallow: true
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we will declare a has_many relationship through reviews so we can access our custom routes association. You will see here that the user &lt;code&gt;has_many :reviewed_breweries, through: :reviews, source: :brewery&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

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

  has_many :breweries,  dependent: :destroy

  has_many :reviews 

  has_many :reviewed_breweries, through: :reviews, source: 
  :brewery

  has_secure_password

  validates :username, presence: true, uniqueness: true

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

&lt;/div&gt;



&lt;p&gt;We will define what data our custom route will give us back in the user controller. In this case, we define profile to display all the breweries the user left a review for.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Api::UsersController &amp;lt; ApplicationController
  skip_before_action :authorized!, only: :create

  def index
    render json: User.all
  end

  def create
    user = User.create!(user_params)
    session[:user_id] = user.id
    render json: user, status: :created
  end

  def show
    render json: @current_user
  end

  def profile
    reviewed = @current_user.reviewed_breweries
    render json: reviewed
  end

  private
  def serialized_user
    @user.to_json(include: :breweries)
  end

  def user_params
    params.permit(:username, :password, 
  :password_confirmation, :image_url, :bio)
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we will make a fetch request on the frontend in our Profile.js file we created and then render the data we want to the page for the user to see. Last, we will add a route to our App.js file to render our Profile.js file.&lt;/p&gt;

&lt;p&gt;What we get back is a profile page for the current user logged in and displays a list of all the breweries the user has left a review for. I hope this helps you, as it did for me, retain some of the basics during your learning process.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Happy Coding!&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

</description>
      <category>react</category>
      <category>beginners</category>
      <category>rails</category>
      <category>routes</category>
    </item>
    <item>
      <title>Models, Views, Controllers Ruby on Rails Basics</title>
      <dc:creator>Walktheworld</dc:creator>
      <pubDate>Mon, 06 Jun 2022 19:36:40 +0000</pubDate>
      <link>https://dev.to/walktheworld/models-views-controllers-on-rails-basics-6ij</link>
      <guid>https://dev.to/walktheworld/models-views-controllers-on-rails-basics-6ij</guid>
      <description>&lt;p&gt;I am currently working on my first Rails Application with a React frontend for my online software engineering program.  My application is a Yelp/Untapped clone where a client/user can login/signup.  Once that user is authenticated they can add a brewery to the database for any valid user to view and leave a review on.  I was required to have a many_to_many relationship, so &lt;code&gt;reviews&lt;/code&gt; is my join table in this instance.  I wanted to share some of the basics of the MVC architecture.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;code&gt;Models&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;Models are in charge of all of the methods we receive through ActiveRecord association (&lt;a href="https://dev.to/walktheworld/active-record-associations-15go"&gt;ActiveRecord Associations and Methods&lt;/a&gt;). It handles all the business logic, dealing with state of the application.  Here is an example of how your &lt;code&gt;User&lt;/code&gt; model may look:&lt;br&gt;
&lt;/p&gt;

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

  has_many :breweries,  dependent: :destroy

  has_many :reviews 

  has_many :reviewed_breweries, through: :reviews, source: :brewery

  has_secure_password

  validates :username, presence: true, uniqueness: true

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

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;code&gt;Views&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The Views are responsible for generating the GUI (graphic user interface) and presenting the data to the user.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;code&gt;Controllers&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The controllers are responsible for the communication between the user/views and the backend. Talking through the models to sort the database and send back the appropriate view to the user.  Here is an example of how your &lt;code&gt;User&lt;/code&gt; controller may look:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Api::UsersController &amp;lt; ApplicationController
  skip_before_action :authorized!, only: :create

  def index
    render json: User.all
  end

  def create
    user = User.create!(user_params)
    session[:user_id] = user.id
    render json: user, status: :created
  end

  def show
    render json: @current_user
  end

  def profile
    reviewed = @current_user.reviewed_breweries
    render json: reviewed
  end

  private
  def serialized_user
    @user.to_json(include: :breweries)
  end

  def user_params
    params.permit(:username, :password, :password_confirmation, :image_url, :bio)
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I know how hard it can be to sift through the endless documents of info out there.  I hope this helps you, as it did for me, retain some of the basics during your learning process.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Happy Coding!&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Resources:&lt;br&gt;
(&lt;a href="https://guides.rubyonrails.org/active_record_basics.html"&gt;https://guides.rubyonrails.org/active_record_basics.html&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Active Record Associations</title>
      <dc:creator>Walktheworld</dc:creator>
      <pubDate>Thu, 31 Mar 2022 17:45:00 +0000</pubDate>
      <link>https://dev.to/walktheworld/active-record-associations-15go</link>
      <guid>https://dev.to/walktheworld/active-record-associations-15go</guid>
      <description>&lt;p&gt;I am currently working on my first Ruby/Sinatra Application for my online software engineering program. I wanted to share what I learned about Active Record Associations and all the built in methods we get access to using it.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;code&gt;has_many&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;An instance of one class that owns many instances of another class. This class must pluralize the has many instance method to get access to all the instances it owns.  &lt;em&gt;A User has many recipes&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Actor &amp;lt; ActiveRecord::Base
    has_many :characters
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Show &amp;lt; ActiveRecord::Base
    has_many :characters
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;has_many&lt;/code&gt; association gives us access to 17 methods&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;actors
actors&amp;lt;&amp;lt;(object, ...)
actors.delete(object, ...)
actors.destroy(object, ...)
actors=(objects)
actor_ids
actor_ids=(ids)
actors.clear
actors.empty?
actors.size
actors.find(...)
actors.where(...)
actors.exists?(...)
actors.build(attributes = {})
actors.create(attributes = {})
actors.create!(attributes = {})
actors.reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;code&gt;belongs_to&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;An instance that is owned by the has many class. We will state the belongs to method as singular to retrieve the relationship to the unique owner class.  &lt;em&gt;A Recipe belongs to one owner&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Character &amp;lt; ActiveRecord::Base
    belongs_to :actor
    belongs_to :show
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To ensure reference consistency, add a foreign key to the owner column of the owned table migration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class CreateRecipes &amp;lt; ActiveRecord::Migration[6.1]
  def change
    create_table :characters do |t|
      t.belongs_to :actor
      t.belongs_to :show
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;belongs_to&lt;/code&gt; association gives us access to 8 methods&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;character
character=(character)
build_character(attributes = {})
create_character(attributes = {})
create_character!(attributes = {})
reload_character
character_changed?
character_previously_changed?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;code&gt;has_many through:&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;This creates a relationship bridge between two owner classes' and the owned/connecting class&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Show &amp;lt; ActiveRecord::Base
    has_many :characters
    has_many :actors, through: :characters
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Controlled Components</title>
      <dc:creator>Walktheworld</dc:creator>
      <pubDate>Thu, 02 Sep 2021 17:16:24 +0000</pubDate>
      <link>https://dev.to/walktheworld/controlled-components-48f7</link>
      <guid>https://dev.to/walktheworld/controlled-components-48f7</guid>
      <description>&lt;p&gt;A controlled component is a component that renders form elements and controls them by keeping the form data in the component's state.&lt;/p&gt;

&lt;p&gt;A controlled form is a form that gets its input values from the state. &lt;/p&gt;

&lt;p&gt;Let's take a look at what that looks like:&lt;/p&gt;

&lt;p&gt;First, we need to create a component that has an initial state. In this case, I use an empty string as my initial colorInput state:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--32J7MLTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/71s0fzqmpr8nb407pkdz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--32J7MLTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/71s0fzqmpr8nb407pkdz.png" alt="component state"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, we  render the form to the page to make sure that everything is connected properly (don't forget to import it to your main container and add to to the render lifecycle) :&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qbCNKrhJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1j7udcr1p09vdghiamtv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qbCNKrhJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1j7udcr1p09vdghiamtv.png" alt="render"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we need to handle the change of state, so we will implement a handleColorInput function for our in-line onChange event, and tell the style to change the color of the text from the state:&lt;/p&gt;

&lt;p&gt;So here is the whole code:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YkRVUCys--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/51n66xe9hbpshjst09pr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YkRVUCys--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/51n66xe9hbpshjst09pr.png" alt="whole code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and this is what that code returns:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A2wHpYjf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gcsgxj0nhvo7cmwr7c6r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A2wHpYjf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gcsgxj0nhvo7cmwr7c6r.png" alt="input form"&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NPyQBhVq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fel6gjkez2lo4fd1njdh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NPyQBhVq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fel6gjkez2lo4fd1njdh.png" alt="input form"&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cdG8fIKW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ldzhyybooxvuxhvzpja3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cdG8fIKW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ldzhyybooxvuxhvzpja3.png" alt="input form"&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KrbqW1Qj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5sdqc6j72bg7s2tijg35.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KrbqW1Qj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5sdqc6j72bg7s2tijg35.png" alt="input form"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Persist data with like button React</title>
      <dc:creator>Walktheworld</dc:creator>
      <pubDate>Wed, 25 Aug 2021 23:07:51 +0000</pubDate>
      <link>https://dev.to/walktheworld/persist-data-with-like-button-react-4n02</link>
      <guid>https://dev.to/walktheworld/persist-data-with-like-button-react-4n02</guid>
      <description>&lt;p&gt;I created a like button that I could use in two different routes to persist data to a third route.&lt;/p&gt;

&lt;p&gt;First I created the LikeBtn class and set its state of liked to false so I could change that status to change the color after it has been clicked. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4-vn2sP1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m459b4b7xpoqwy3a8h1t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4-vn2sP1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m459b4b7xpoqwy3a8h1t.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, I gave the button a handleClick function to change that state of liked from false to true. Then I used a GET request and the POST method to persist that data to my localhost server. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8IGYeiiP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xyptc3j9nbho6mf5sft7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8IGYeiiP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xyptc3j9nbho6mf5sft7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, I use render to change the style color and the onClick functionality and render and all other properties of the button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qFLESfh0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdu75ei3kqpz52uqnjuc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qFLESfh0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdu75ei3kqpz52uqnjuc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's take a look at the full code. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R4NS7wjC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m0k7tea6052vyyv8uhyk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R4NS7wjC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m0k7tea6052vyyv8uhyk.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Key Takeaways From My First JS Project</title>
      <dc:creator>Walktheworld</dc:creator>
      <pubDate>Wed, 16 Jun 2021 19:21:45 +0000</pubDate>
      <link>https://dev.to/walktheworld/key-takeaways-from-my-first-js-project-3haa</link>
      <guid>https://dev.to/walktheworld/key-takeaways-from-my-first-js-project-3haa</guid>
      <description>&lt;p&gt;Asynchronous requests allow our code to multi-task.&lt;/p&gt;

&lt;p&gt;A fetch() request has three statuses; Promise, Response, &amp;amp; Error. &lt;/p&gt;

&lt;p&gt;-The promise is the HTML API source.&lt;/p&gt;

&lt;p&gt;-The Response is the data from the source.&lt;/p&gt;

&lt;p&gt;-Error occurs when no response is returned.&lt;/p&gt;

&lt;p&gt;An EventListener takes an action ("click", "submit") and a callback function written as arrow function (()=&amp;gt;{}). &lt;/p&gt;

&lt;p&gt;Function() should only be used when it is the start of the code otherwise ES6 is standard (i.e arrow function).&lt;/p&gt;

&lt;p&gt;Know your data! &lt;/p&gt;

&lt;p&gt;When you change one thing make sure you go through and restructure anything else that references that original location where the change was made. I found myself iterating through one object over and over again with a forEach statement, which I had written initially for an API with multiple objects.&lt;/p&gt;

&lt;p&gt;Know your code!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bKjoNb1c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3v4yhtcfnu0pmmr05rm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bKjoNb1c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3v4yhtcfnu0pmmr05rm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Deactivate / Disable Button after Click</title>
      <dc:creator>Walktheworld</dc:creator>
      <pubDate>Wed, 26 May 2021 19:51:58 +0000</pubDate>
      <link>https://dev.to/walktheworld/how-to-deactivate-disable-button-after-click-50o1</link>
      <guid>https://dev.to/walktheworld/how-to-deactivate-disable-button-after-click-50o1</guid>
      <description>&lt;p&gt;So I am working on my first Javascript/HTML project for coding school. I made it so that when the user clicks on a button it would render some API data onto the page. But if the user clicked that same button more than once it would add the same data to the page with every click.&lt;/p&gt;

&lt;p&gt;First I tried to see if I could find a way to dynamically disable the button with JS code without having to write a whole function. I tried to use the btn.id = "" format with .onclick while dynamically creating the button and that did not work.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gNgoGJlr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sv1bdkkidy5ff6ul39b9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gNgoGJlr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sv1bdkkidy5ff6ul39b9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The only solution I got to work was to add a disableButton() function, create the button in the HTML file and add an onclick classification inside of its tag activating that JS function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gUm82uBa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m83269kzoqxd2037atqv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gUm82uBa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m83269kzoqxd2037atqv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>firstpost</category>
      <category>html</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
