<?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: Tor Francis</title>
    <description>The latest articles on Forem by Tor Francis (@torfrancis447).</description>
    <link>https://forem.com/torfrancis447</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%2F959308%2F92444200-407f-4963-830a-7566f313aa19.jpg</url>
      <title>Forem: Tor Francis</title>
      <link>https://forem.com/torfrancis447</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/torfrancis447"/>
    <language>en</language>
    <item>
      <title>Life after Boot Camp</title>
      <dc:creator>Tor Francis</dc:creator>
      <pubDate>Fri, 24 Mar 2023 16:43:39 +0000</pubDate>
      <link>https://forem.com/torfrancis447/life-after-boot-camp-4m77</link>
      <guid>https://forem.com/torfrancis447/life-after-boot-camp-4m77</guid>
      <description>&lt;p&gt;Congratulations on completing your coding boot camp! You've spent numerous hours on your final project and are now in the process of figuring out your next steps with the ultimate goal of landing a job. However, you may find yourself feeling lost and overwhelmed with the plethora of advice on what to do next. Do you start by building a portfolio or focus on fixing bugs in your project? Do you prioritize learning new concepts or mastering the fundamentals? Should you start mass-applying to jobs or first improve your resume? It's easy to feel jumbled and confused when trying to navigate the post-bootcamp phase. After some reflection, I've come up with a game plan that can help you make sense of it all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Take a break&lt;/strong&gt;&lt;br&gt;
The first thing you should do is take a break. After all the hard work you've put in, you need some time to recharge. Take a few days or a week to rest and disconnect from the critical thinking required during boot camp.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a list of goals&lt;/strong&gt;&lt;br&gt;
Once you've rested, it's time to create specific goals and steps to achieve them. Start by identifying a goal, such as fixing a bug in your project, even if you're not sure how to do it yet. Then, break down the goal into smaller steps, such as researching the issue or seeking help from a mentor. Write these steps down and store them somewhere that is easily accessible, I use &lt;a href="http://notion.com/"&gt;Notion&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a schedule&lt;/strong&gt;&lt;br&gt;
Now that you have your goals and steps in place, it's time to create a schedule. Decide how much time you want to allocate to each task on a daily or weekly basis. For example, you could spend two hours a day working on LeetCode questions or one hour a day applying to jobs. Alternatively, you could designate specific days of the week to work on certain tasks. It's important to set realistic expectations and stick to the schedule as much as possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stick to the schedule&lt;/strong&gt;&lt;br&gt;
Sticking to the schedule you've created is crucial to building the habits you need to achieve your goals. Adjust the schedule as needed to fit your work flow, but be sure to remain consistent. Even if you don't accomplish everything you set out to do, record your progress and pick up where you left off. As you complete tasks and cross them off your list, you'll gain momentum and see progress.&lt;/p&gt;

&lt;p&gt;Navigating life after coding boot camp can be daunting, but with a clear plan in place, you can achieve your goals and find success. Remember to take breaks, create specific goals and steps, and stick to a schedule. With hard work and dedication, you'll be well on your way to landing your dream job. Best of luck!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>beginners</category>
      <category>life</category>
    </item>
    <item>
      <title>Using Active Storage in Ruby on Rails Api</title>
      <dc:creator>Tor Francis</dc:creator>
      <pubDate>Thu, 16 Feb 2023 21:33:42 +0000</pubDate>
      <link>https://forem.com/torfrancis447/using-active-storage-in-ruby-on-rails-api-1071</link>
      <guid>https://forem.com/torfrancis447/using-active-storage-in-ruby-on-rails-api-1071</guid>
      <description>&lt;p&gt;Hi, if your building a project like I am and want to use Active Storage to handle file upload then you've come to the right place. &lt;/p&gt;

&lt;p&gt;First step is to setup your environment by creating a new rails application. I used postgresql for my database. &lt;/p&gt;

&lt;p&gt;Now you will want to create and migrate your model and controller for whatever table you want to have files for. Let's use User as our model.&lt;/p&gt;

&lt;p&gt;install the Active Storage gem&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rails active_storage:install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This will create a migration will 3 tables: active storage blobs, active storage attachments, active storage variant records.&lt;/p&gt;

&lt;p&gt;create your schema by running:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rails db:migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now you will want to create an association(macro) to your User table.&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_one_attached :image
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We are going to make the attachment an Image, you can name it whatever kind of file it's going to be, we will reference it in our UsersController.&lt;/p&gt;

&lt;p&gt;Next, you will want to create the params for the User in the UsersController.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def user_params
  params.require(:user).permit(:name, :image)
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In your gem , you'll want to uncomment out&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# gem 'rack-cors' 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and run a bundle install. This will add it to your gemfile.lock&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rack-cors (1.1.1)
rack (&amp;gt;= 2.0.0)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Go to config/initializers/cors.rb and you'll see a new file added:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
# Be sure to restart your server when you modify this file.

# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.

# Read more: https://github.com/cyu/rack-cors

# Rails.application.config.middleware.insert_before 0, Rack::Cors do
#   allow do
#     origins 'example.com'
#
#     resource '*',
#       headers: :any,
#       methods: [:get, :post, :put, :patch, :delete, :options, :head]
#   end
# end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Uncomment out everything after 'Read more: &lt;a href="https://github.com/cyu/rack-cors" rel="noopener noreferrer"&gt;https://github.com/cyu/rack-cors&lt;/a&gt;'. If your using a react app you'll want to replace origins will your react app server&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.config.middleware.insert_before 0, Rack::Cors do
   allow do
     origins 'example.com'
&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; Rails.application.config.middleware.insert_before 0, Rack::Cors do
   allow do
     origins 'http://localhost:3000'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Make sure you input the correct server you using or you will get an error.&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
resources :users, only: [:create]
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 UsersController &amp;lt; ApplicationController
  def create
        user = User.create(user_params)
        if user.valid?
            user.save
            render json: user, status: :created
        else
            render json: { errors: ['User not valid']}, status: 422
        end
    end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;On your Frontend you'll want to create an form that that send a POST to your backend route. I'm using Material UI for styling.&lt;/p&gt;

&lt;p&gt;I created a SignUpForm component for the form and useState for our Input fields. For our file input field we specify the input type for our file. In Material UI, we use inputProps that. &lt;/p&gt;

&lt;p&gt;We add an on change function that uses an anonymous function that take in an event(e) and calls the setter function from our useState.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from "react";
import { TextField, Input, Typography, Button } from "@mui/material";

Function SignupForm(){
const [image, setImage] = useState([])
[name, setName] = useState("")


return (
 &amp;lt;form&amp;gt;
   &amp;lt;Typography&amp;gt; Name &amp;lt;/Typography&amp;gt;
        &amp;lt;TextField
          label="Name"
          value={name}
          onChange={(event) =&amp;gt; 
          setName(event.target.value)}

        /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;Input
          label="Image"
          type="file"          
          inputProps={{ accept: "image/*" }}
          onChange={(event) =&amp;gt; 
          setImage(event.target.files[0])}
          name="image"
        /&amp;gt;

        &amp;lt;br /&amp;gt;
        &amp;lt;Button color="primary" type="submit"&amp;gt;
          Submit
        &amp;lt;/Button&amp;gt;
 &amp;lt;/form&amp;gt;
)
}
export default SignUpForm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Notice that our onChange for Name and Image are different. When were selecting a file, we can typically select multiple files. We use "event.target.files[0]" because the files are in an array and we just want the first so we add an index of 0. This means we also have to set our initial state of image to an array.&lt;/p&gt;

&lt;p&gt;We will add a function to the form that sends a POST request to our end point in our Backend. Because we have a file we have to send, we can't send a normal object. Instead We'll send a FormData object that we'll construct in the function.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function handleSubmit(e) {
    e.preventDefault();
    const data = new FormData();
    data.append("user[image]", image);    
    data.append("user[name]", name);


    fetch("http://localhost:3000/users", {
      method: "POST",
      body: data,
    })
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We structure our FormData object in a manner that ruby accepts and send it to the backend without stringifying it. Add the handle submit to the form and test it out.&lt;/p&gt;

&lt;p&gt;If open up the console, you will see that the new user has an image at attached.&lt;/p&gt;

&lt;p&gt;Thank you!&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;a href="https://guides.rubyonrails.org/active_storage_overview.html" rel="noopener noreferrer"&gt;
      guides.rubyonrails.org
    &lt;/a&gt;
&lt;/div&gt;



</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>Using Serializers with ruby on rails</title>
      <dc:creator>Tor Francis</dc:creator>
      <pubDate>Thu, 26 Jan 2023 20:21:38 +0000</pubDate>
      <link>https://forem.com/torfrancis447/using-sterilizers-with-ruby-on-rails-27oj</link>
      <guid>https://forem.com/torfrancis447/using-sterilizers-with-ruby-on-rails-27oj</guid>
      <description>&lt;p&gt;If you've ever wanted to want to have your data return specific kinds of data from different paths using Active Record with out having to write a lot of extra code serializers are the solution. They provide a way of reacting a custom json object.&lt;/p&gt;

&lt;p&gt;This is what our data looks like now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "id": 1,
  "title": "Top Gun",
  "year": 1986,
  "length": 154,
  "summary": "As students at the United States Navy's elite fighter weapons school compete to be best in the class, one daring young pilot learns a few things from a civilian instructor that are not taught in the classroom.",
  "poster_url": "https://www.google.com/url?sa=i&amp;amp;url=https%3A%2F%2Fwww.imdb.com%2Ftitle%2Ftt0092099%2F&amp;amp;psig=AOvVaw0uR8BYBdnNmkTirteXeQzJ&amp;amp;ust=1674849371237000&amp;amp;source=images&amp;amp;cd=vfe&amp;amp;ved=0CA8QjRxqFwoTCIj9-Z6C5vwCFQAAAAAdAAAAABAE",  
  "created_at": "2022-05-21T13:12:35.682Z",
  "updated_at": "2022-05-21T19:11:11.682Z"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;use the command below to have it installed in the gem file&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gem 'active_model_serializers'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Once you run a bundle install then run:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rails g serializer model_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;it gets created in  #app/serializers/model_name_serializer.rb&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class ModelNameSerializer &amp;lt; ActiveModel::Serializer
  attributes :id, :title, :year, :length, :director, :description, :poster_url, :summary

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

&lt;/div&gt;


&lt;p&gt;after the serializer is created, it should now look like this:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "id": 1,
  "title": "Top Gun",
  "year": 1986,
  "length": 154,
  "summary": "As students at the United States Navy's elite fighter weapons school compete to be best in the class, one daring young pilot learns a few things from a civilian instructor that are not taught in the classroom.",
  "poster_url": "https://www.google.com/url?sa=i&amp;amp;url=https%3A%2F%2Fwww.imdb.com%2Ftitle%2Ftt0092099%2F&amp;amp;psig=AOvVaw0uR8BYBdnNmkTirteXeQzJ&amp;amp;ust=1674849371237000&amp;amp;source=images&amp;amp;cd=vfe&amp;amp;ved=0CA8QjRxqFwoTCIj9-Z6C5vwCFQAAAAAdAAAAABAE"  
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If you wanted to u wanted to create a custom method to return specific data based on what you have now, you could say:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def MovieCaption
  "#{self.object.title} - #{self.object.description}..."
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and add that method to the attributes to return.&lt;/p&gt;

&lt;p&gt;If you had an array of objects you have specify which serializer to use:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;render json: movies, each_serializer: ModelNameSerializer, status: :ok
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Something to be mindful is that serializers override when you want to specify what you return in the controller.&lt;/p&gt;

&lt;p&gt;Here is a link to the Docs to read more on it.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;a href="https://api.rubyonrails.org/classes/ActiveModel/Serialization.html" rel="noopener noreferrer"&gt;
      api.rubyonrails.org
    &lt;/a&gt;
&lt;/div&gt;



&lt;p&gt;Thank you.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Intro to Big O Notation</title>
      <dc:creator>Tor Francis</dc:creator>
      <pubDate>Tue, 10 Jan 2023 14:57:57 +0000</pubDate>
      <link>https://forem.com/torfrancis447/big-o-notation-2ion</link>
      <guid>https://forem.com/torfrancis447/big-o-notation-2ion</guid>
      <description>&lt;p&gt;If you've worked on algorithm problems, then you've probably heard of Big O. It looks pretty intimidating and hard at first glance. Many sources have told me I don't really need to know it as a jr. dev, others have told be me that understanding it will make be a better dev. I've listened to the latter.&lt;/p&gt;

&lt;p&gt;Big O notation is used to describe the performance of an algorithm. It is used to describe time and space it takes for the algorithm to execute. It takes into account the worst case scenario and best case. &lt;/p&gt;

&lt;p&gt;N is the variable that represents the size of the input data.&lt;/p&gt;

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

&lt;p&gt;O(1) describes as algorithm that will always take the same about of time to do such and console.log(x) or array[0]. The run time is constant and with never change because it will always take the same amount of time to puts or print that information.&lt;/p&gt;

&lt;p&gt;As I practice this more, I will make more post about this and continue down this hole.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Deconstructing props and nested data</title>
      <dc:creator>Tor Francis</dc:creator>
      <pubDate>Fri, 09 Dec 2022 18:44:31 +0000</pubDate>
      <link>https://forem.com/torfrancis447/deconstructing-props-and-nested-data-5hjo</link>
      <guid>https://forem.com/torfrancis447/deconstructing-props-and-nested-data-5hjo</guid>
      <description>&lt;p&gt;Hi all, I'm here with another post to take you through when I released how useful constructing props. I built a react web app where I used an API to fetch Video Games from RAWG API and I ran into some road blocks. This was my first project in react and I had previously worked with worked with an external API so I thought I wouldn't have an issue. &lt;/p&gt;

&lt;p&gt;I was wrong.&lt;/p&gt;

&lt;p&gt;I first started with fetching my data and storing it in a &lt;a href="https://reactjs.org/docs/hooks-state.html"&gt;State Hook&lt;/a&gt;. My goal was to make a single page application that populated data in to the DOM and be able save the games that you want to play.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---eABo75a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/avnx9qxv02wevncp1r0f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---eABo75a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/avnx9qxv02wevncp1r0f.png" alt="Image description" width="474" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I created a fetch request for my data and initial returned an a nested object so I used dot notation to to get to what I actually needed. (&lt;em&gt;Data.results&lt;/em&gt;) I put it in state because I knew that I would need it to change what was display at some point. I passed it down to another component that functioned as a container for my data because I wanted to map over it. Data.results returned an array so I could iterate through it in my container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pd3yzcuK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iku10dr5zmi2cpyjhz4m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pd3yzcuK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iku10dr5zmi2cpyjhz4m.png" alt="Image description" width="373" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I could dot notate through each item in the array at the container level and pass down props off the information that I wanted. However I also wanted to create another component that contained the information this same information on a separate component. I created a function that would post this information to another database and pass it down to to the card component as props.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HGRsaHBL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0sr5ctg0kvzgoqx7ak5s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HGRsaHBL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0sr5ctg0kvzgoqx7ak5s.png" alt="Image description" width="532" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This function would take in a specific item and post it to a db.json file that I created with &lt;a href="https://www.npmjs.com/package/json-server"&gt;JSON-server&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;My component that only had the saved games would fetch the object that I saved to the db.json. The issue I ran into was that once it was posted into my db, it now had it's own id and key assigned to it. Initial I was going to make a new component that only rendered the games in the db and not reuse the initial game card component. After a little guidance, research, understanding of how props work. I realized that prop can be anything. You can pass props to a component that represents different things. My card component doesn't need to know what it exactly is it just needs to be the same type to do the same thing or behave the same way. I had 2 come contains that pass similar things and a function that did similar thing. One function posted to my internal db.json and another my set the state what appear on the DOM. I deconstructed what everything was in the parent function before passing it down.&lt;/p&gt;

&lt;p&gt;Thank you for reading my blog! I'll post a part 2&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>react</category>
      <category>programming</category>
    </item>
    <item>
      <title>innerHTML and textContent</title>
      <dc:creator>Tor Francis</dc:creator>
      <pubDate>Mon, 21 Nov 2022 01:53:27 +0000</pubDate>
      <link>https://forem.com/torfrancis447/innerhtml-and-textcontent-g1g</link>
      <guid>https://forem.com/torfrancis447/innerhtml-and-textcontent-g1g</guid>
      <description>&lt;p&gt;Hey all I'd like to go over a HTML concept about some differences in properties of HTML and when they are rendered to the DOM.&lt;/p&gt;

&lt;p&gt;As a beginner like myself, the difference between innerHTML and textContent did not seem very different until ran into a problem on a project I was working on. &lt;/p&gt;

&lt;p&gt;The first web app I built was a mood playlist site that used the Spotify API to render playlist based on input of the user's mood.&lt;br&gt;
If you've used Spotify before or any digital music app then your  probably aware that you can create and publish a playlist. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lKEvJqDq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0cgawr5fzeac9o0038hc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lKEvJqDq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0cgawr5fzeac9o0038hc.png" alt="Image description" width="783" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I typically use textContent when rendering just text to the DOM because I knew what data was going to be. However, when I didn't know what my data was going to be, it became a learning opportunity.&lt;/p&gt;

&lt;p&gt;I realized that my Spotify data had other html elements inside of what I thought was just text. To be specific, it was string.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_vuiwVaX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f86r4846s389in3vyvxj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_vuiwVaX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f86r4846s389in3vyvxj.png" alt="Image description" width="375" height="48"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;a href="https://www.w3schools.com/JSREF/prop_node_textcontent.asp" rel="noopener noreferrer"&gt;
      w3schools.com
    &lt;/a&gt;
&lt;/div&gt;
 W3School says that textContent sets the text content of the specified node. It also says that textContent returns the text content of the element and all descendances, with spacing and CSS hidden text, but without tags. 

&lt;p&gt;So why does it have the tag?&lt;/p&gt;

&lt;p&gt;We are returning just the string with HTML inside of it. If we look at MDN's description of innerHTML &lt;a href="https://dev.tourl"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML&lt;/a&gt;, it set's the HTML from the element. I wanted to have the html from my data reflected on the DOM so I need innerHTML to parsed the string into HTML.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6DY6VsoH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ygwgbr12ruoy87yoc3iz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6DY6VsoH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ygwgbr12ruoy87yoc3iz.png" alt="Image description" width="363" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's working now! Thank you for reading my blog post!&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>New Journey Starts Here</title>
      <dc:creator>Tor Francis</dc:creator>
      <pubDate>Fri, 18 Nov 2022 16:03:13 +0000</pubDate>
      <link>https://forem.com/torfrancis447/new-journey-starts-here-3f9c</link>
      <guid>https://forem.com/torfrancis447/new-journey-starts-here-3f9c</guid>
      <description>&lt;p&gt;Hi, welcome to my page. I never made a blog before , but this is one of many firsts for me!&lt;/p&gt;

&lt;p&gt;My name is Tor (like Thor without the h) and I live in Philadelphia, PA. I've lived in the city for about 8 years now and I've come to call it my home. &lt;/p&gt;

&lt;p&gt;I have the typical story of getting a 4 year degree in something I didn't have a passion for, I come from a background in sales.&lt;/p&gt;

&lt;p&gt;Last month I made a big change in my life by deciding to change career's into web development. I decided to attend Flatiron School about a lot of research into what I wanted out of a school.&lt;/p&gt;

&lt;p&gt;I don't regret it one bit! I've always thought programing was interesting ,but never chased it. I always thought that I was "too hard" or "I'm not smart enough" to do it. After some dabbling with some free resources and a few student loans later, I realized that it's not as hard as I thought it was.&lt;/p&gt;

&lt;p&gt;In the month that I've been in the program, I learned that the reason I thought it was too hard was because of my mindset. Once I learned how the program would think, It made a lot more sense when I tried applying what I learn. &lt;/p&gt;

&lt;p&gt;Thanks for reading my blog! I look forward to posting more along my journey.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
