<?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: anette87</title>
    <description>The latest articles on Forem by anette87 (@anette87).</description>
    <link>https://forem.com/anette87</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%2F377881%2F5783ef96-0106-46e1-a75e-c7382c2a1f2c.jpeg</url>
      <title>Forem: anette87</title>
      <link>https://forem.com/anette87</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/anette87"/>
    <language>en</language>
    <item>
      <title>React | The ABC of Lifecycle Methods</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Thu, 28 Jan 2021 23:39:56 +0000</pubDate>
      <link>https://forem.com/anette87/react-the-abc-of-lifecycle-methods-p0p</link>
      <guid>https://forem.com/anette87/react-the-abc-of-lifecycle-methods-p0p</guid>
      <description>&lt;p&gt;Hi Developers! In a couple of blogs ago we talked about the two ways to create a component. These are: functional components and class components. When we create a class component, we have the advantage that by extending it from &lt;strong&gt;React.Component&lt;/strong&gt; it will provide us with more methods and properties, which will exponentially improve the component. Part of that methods is what we know as Lifecycle methods. Components in React goes through a lifecycle of events. An easy way to understand this is by thinking about the lifecycle of a plant.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;You sow the plant.&lt;/li&gt;
&lt;li&gt;The plant grows and changes with time.&lt;/li&gt;
&lt;li&gt;The plant dies.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To understand this better is necessary to know that React.Component has three life cycles:&lt;/p&gt;

&lt;p&gt;a. Mounting: when a component is instantiated and inserted into the DOM&lt;br&gt;
b. Updating: when the properties (props) or the state (state) of the component undergo any change.&lt;br&gt;
c. Unmounting: when the component is removed from the DOM.&lt;/p&gt;

&lt;p&gt;Each life cycle will provide us with different life cycle methods for the component, depending on which phase it is in, we will be able to use:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;i&gt;a. Mounting&lt;/i&gt; -&amp;gt; render() -&amp;gt;  &lt;strong&gt;componentDidMount()&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It is invoked immediately after the component is mounted. &lt;/li&gt;
&lt;li&gt;This loads data from an API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;componentDidMount()&lt;/strong&gt; allows the use of setState(). Calling the setState() here will update state and cause another rendering but it will happen before the browser updates the UI. This is to ensure that the user will not see any UI updates with the double rendering.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;i&gt;b. Updating&lt;/i&gt; -&amp;gt; render() -&amp;gt; &lt;strong&gt;componentDidUpdate()&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Invoked immediately after the update occurs.&lt;/li&gt;
&lt;li&gt;This method is NOT called in the initial rendering.&lt;/li&gt;
&lt;li&gt;It is useful for making API requests, as long as the properties (this.props) are compared with the prevProps argument, so that if there are no changes, it does not affect.&lt;/li&gt;
&lt;li&gt;We can modify the state (setState), but, like the previous point, the current this.state must be compared with the previous prevState, since otherwise you can generate an infinite loop.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;i&gt;c. Unmounting&lt;/i&gt; --&amp;gt; &lt;strong&gt;componentWillUnmount()&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Invoked immediately before disassembling and destroying the component.&lt;/li&gt;
&lt;li&gt;It is useful for "cleaning tasks" suchs a timers, network requests, subscriptions, etc. &lt;/li&gt;
&lt;li&gt;This component will never be re-rendered and because of that we cannot call setState() during this lifecycle method.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This diagram below is from the official React documentation. Here you can see the different React lifecycle methods and when they are invoked.&lt;/p&gt;

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

&lt;p&gt;Lifecycles are not the easiest part to explain in React and it's much more than this blog. I hope at least this little preview helped you understand the basics so you can go deeper into these methods. To be honest, it took me a lot of reading and playing with my code and the console to understand how they work, but once you got it, you got it. To learn more about lifecycles I recommend this &lt;a href="https://www.w3schools.com/react/react_lifecycle.asp"&gt;documantation&lt;/a&gt; from w3schools. The way they explain lifecycles is really simple and easy to follow, so go and check their website now. You can thank me later. &lt;/p&gt;

&lt;p&gt;Thank you for reading! :) &lt;/p&gt;

</description>
    </item>
    <item>
      <title>React | State</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Fri, 22 Jan 2021 01:23:05 +0000</pubDate>
      <link>https://forem.com/anette87/react-state-ki6</link>
      <guid>https://forem.com/anette87/react-state-ki6</guid>
      <description>&lt;p&gt;Hi Developers! In my last blog, we talked about how to pass data between React Containers using Props. This is really helpful, but the only downside is that Props are read-only meaning that we can't change their original value. For that, we need something called State. &lt;/p&gt;

&lt;p&gt;It is absolutely impossible to talk about React basics and not talk about States. I think you'll agree when I say that React props are a very important and interesting feature of the framework but very quickly you realize that you need something more. Especially because without states, your React components are simple templates.&lt;/p&gt;

&lt;p&gt;But, what's a state? A state in React is a mutable data store of components that are also autonomous meaning that the state belongs to an autonomous class that anyone can import and use in their application. Props and states are both attributes of a class, so you can use &lt;code&gt;this.state&lt;/code&gt; and / or &lt;code&gt;this.pros&lt;/code&gt;, but they have different purposes: while properties are immutable, the values ​​of the states can change. They are mutable. The values ​​of the props are passed from parents to children and the values ​​of the states are defined in the component, they do not start in the parent component, and you cannot call &lt;code&gt;setState ()&lt;/code&gt; in the render ().&lt;/p&gt;

&lt;p&gt;A good example of how to use State could be a countdown. In a countdown, you would need the numbers to change every second. For that, you could not use a property because the value needs to change every second. You could also use the states in other situations where you need to make a request to the server to fetch the information you want to see on the screen, but you don't want other parts of your UI to update.&lt;/p&gt;

&lt;p&gt;Using states, React intelligently updates the view for you, where it needs to be updated.&lt;/p&gt;

&lt;p&gt;Now let's see State in action in our code:  &lt;/p&gt;

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

&lt;p&gt;I divided this code into three parts to have a better understanding of the steps you need to follow as you set your state. &lt;/p&gt;

&lt;p&gt;1) We need to set our state in our class. Remember, to use &lt;strong&gt;state&lt;/strong&gt; you would need to always use a class because &lt;strong&gt;setState&lt;/strong&gt; is inherited from the base Component class. To set state you just need to call &lt;strong&gt;state&lt;/strong&gt; and inside the curly braces create your object adding key:value pairs. The initial value can be pretty much anything: a string, number, array, etc.   &lt;/p&gt;


&lt;pre&gt;&lt;code&gt; state = {&lt;br&gt;
name: "Anette"&lt;br&gt;
} &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;2) In this example I created a function to call our setState. In this case, the state will be changed when the user clicks on our &lt;strong&gt; p &lt;/strong&gt; tag. Updating states is as simple as declaring &lt;code&gt;this.setState (data, callback)&lt;/code&gt;. You just have to remember that React merges the data with the existing states and then calls render (). &lt;/p&gt;

&lt;p&gt;setState() updates only the state you want. It doesn't always update the whole object. For example, if in an object you have different states, like the first name, last name, age and you only want to update the age, all you have to do is &lt;code&gt;this.setState ({name: "Steven});&lt;/code&gt;. The other values ​​will remain the same.&lt;/p&gt;

&lt;p&gt;Also, keep in mind that setState () works asynchronously. State is not immediately available after calling setState (), that's why it's important to have the callback in setState (). It is a way of ensuring that the new state is available. FYI, &lt;i&gt;changing the state without using setState () is considered anti-pattern so please, don't even think about that.&lt;/i&gt; &lt;/p&gt;

&lt;p&gt;3) The way to access your state inside your code is using &lt;code&gt; this.state.name &lt;/code&gt;. &lt;i&gt;In this case, we assign our data using JSX syntax and that's why we using curly braces.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;States allow your applications to be interactive and have dynamic information. At the same time, they are useful when you need to see the changes in the server's response to a request. I imagine that now you can see how helpful and necessary is &lt;strong&gt;states&lt;/strong&gt; in our apps, right? React is pretty great!&lt;/p&gt;

&lt;p&gt;Thank you for reading! :) &lt;/p&gt;

</description>
    </item>
    <item>
      <title>React | Props</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Thu, 14 Jan 2021 08:09:56 +0000</pubDate>
      <link>https://forem.com/anette87/react-props-2i90</link>
      <guid>https://forem.com/anette87/react-props-2i90</guid>
      <description>&lt;p&gt;Hello developers! In my last blog, we talked about &lt;i&gt;components&lt;/i&gt; and what Stateful, Stateless, and Presentational Components mean in the world of React. That's fantastic! At this point, you're feeling confident creating components and that would allow you to bring to life a flexible and organized application. &lt;/p&gt;

&lt;p&gt;If you're learning React  I can assume you are familiar with JavaScript. If you're familiar with JavaScript you know what Objects Properties are. So at this point, you know something is missing and you're thinking: &lt;i&gt;"Well, components are great and everything, but how can I pass my data from component to component?"&lt;/i&gt; You probably already guessed the answer. Yes, we use &lt;strong&gt;props&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Something really functional and practical about components is that they're reusable. As a developer, we don't like repeating code. Using components is the best way in react to avoid that. Let's take a look at this example: &lt;/p&gt;

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

&lt;p&gt;The first thing you have to know about passing components is that they need to be imported and exported. Our component can be exported thanks to the following line of code:&lt;/p&gt;

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

&lt;p&gt;Ok, now let's see what's going on here. Let's start with line 2:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import ComponentEx from "./ComponentEx;"&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This code is quite self-explanatory. In this case, we're importing the ComponentEx from the file "./ComponentEx. Something worth knowing is that &lt;strong&gt;ComponentEx&lt;/strong&gt; is just a placeholder for the file. You could name this &lt;strong&gt;LalaLand&lt;/strong&gt; and would work the same. For code etiquette (and logic) we use the component name to represent the component we're importing. &lt;/p&gt;

&lt;p&gt;Now, let's take a look at line 13: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt; &amp;lt; ComponentEx name={"Ethan"} age={"8"} user={user} / &amp;gt; &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We want to pass data from one component to another because we don’t want to have a component rendering static data. The goal is to pass dynamic data to your component instead. That’s where React’s props come into play. The way we pass data in React is by defining custom HTML attributes.  In our example, we have three props been pass to our component: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;name={"Ethan"}
age={"8"}
user={user}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We'll assign our data using JSX syntax. &lt;strong&gt;Don’t forget the curly braces!&lt;/strong&gt; As you can see your data can be pass in different forms. In this case, I'm passing a string, a number, and an object. Pretty great, right?&lt;/p&gt;

&lt;p&gt;Let's take a look at our &lt;strong&gt;ComponentEx&lt;/strong&gt; component:&lt;/p&gt;

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

&lt;p&gt;As we can see, we pass props as an argument in our functional component. Once you have your "props" you're ready to use the data. In this case, I'm outputting the data on a &lt;strong&gt;p tag&lt;/strong&gt;. The way we access the data using props is the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; {props.name} &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Again, we're using JSX so&lt;strong&gt; don’t forget the curly braces!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;...and that's it! Now, you're ready to pass data between components! &lt;/p&gt;

&lt;p&gt;I would like to discuss three important things before finishing this blog:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Props are inherited from the parent components to the child component. Keep this in mind when creating the logistics or your application. &lt;br&gt;
&lt;strong&gt;2.&lt;/strong&gt; When using a class just add &lt;strong&gt;this&lt;/strong&gt; before props. For example: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt; {this.props.name} &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Remember, when we use a class we're extending &lt;strong&gt;React.Component&lt;/strong&gt; which include the &lt;strong&gt;props&lt;/strong&gt; properties. I know, Magic! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Props are read-only. Passing props from component to component doesn’t make the component interactive. To do so, we need to use something call &lt;strong&gt;state.&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;Now, that's it! For real this time. In the next blog, we will learn more about our new friend &lt;strong&gt;state&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Thank you for reading! 😊 &lt;/p&gt;

</description>
    </item>
    <item>
      <title>React | Components: Stateful, Stateless &amp; Presentational. </title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Thu, 07 Jan 2021 23:30:47 +0000</pubDate>
      <link>https://forem.com/anette87/react-components-stateful-stateless-presentational-5304</link>
      <guid>https://forem.com/anette87/react-components-stateful-stateless-presentational-5304</guid>
      <description>&lt;p&gt;Hello developers! In my last blog, we learn more about the Structure of our React App. Today, I want to talk more in-depth about a very important part of this structure, our &lt;strong&gt; components &lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;To be honest, the concept of a component is something quite simple to understand. Think about your components as a visual software element that has its own state, receives some properties, and implements its own rendering logic. Easy, right? Now you're probably thinking that all components are the same and guess what? &lt;strong&gt;You're wrong!&lt;/strong&gt; 🤣 &lt;/p&gt;

&lt;p&gt;But don't you worry! This blog's purpose is to be a tour of some of the types of components that we can use in React. Specifically, the three types of components you would use and see more frequently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Stateful Component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Without a doubt, these types of components are the most used. The three main characteristics of a Stateful Component are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;use encapsulation in &lt;strong&gt;classes&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;have a &lt;strong&gt;state&lt;/strong&gt; that they define&lt;/li&gt;
&lt;li&gt;update and each change in both props and state calls the &lt;strong&gt;render&lt;/strong&gt; method.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;i&gt;Example of a Stateful Component:&lt;/i&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wGkxXDxo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qkdo1d4v5h90sx3cu124.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wGkxXDxo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qkdo1d4v5h90sx3cu124.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A stateful component is dependent on its state object and can change its own state. The component re-renders based on changes to its state, and may pass down properties of it's state to child components as properties on props. &lt;i&gt;We will talk more about props in my next blog.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Stateless Component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These types of components are defined as functions in Vanilla JavaScrip and don't have or work with state. The only data that this type of component works with is with the received props, also it does not allow working with overwriting the methods of its life cycle. The advantages of this type of component is that they are simple to write, easily testable and improve performance. &lt;/p&gt;

&lt;p&gt;&lt;i&gt;Example of a Stateless Component:&lt;/i&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xVjWrNFZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/x2ltueu2prlpg96wbj5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xVjWrNFZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/x2ltueu2prlpg96wbj5n.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An easy way to remember when the component is Stateful or Stateless at the beginning of your React journey is this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stateful = class &lt;/li&gt;
&lt;li&gt;Stateless = function&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;i&gt;Note: In theory, you can use either a function or a class for creating stateless components. But unless you need to use lifecycles in your components, you should go for stateless functional components. In addition, Hooks are introducing in React 16.8. They let you use state and other React features without writing a class, but that's another story. Let's keep things simple for now. &lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.Presentational Components&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;This last component is known as a structural component, meaning that these types of components do not technically correspond to any API element, class, or function in React, they are just purely conceptual.&lt;/i&gt; &lt;/p&gt;

&lt;p&gt;These types of components should only focus and focus their efforts on how the UI should be rendered. They can be made up of other visual elements and often include styles and classes. All the data involved in its rendering must be received through props, so it must be independent of calls to external services. These types of components are usually of the Stateless type since they do not need state, and must manage the actions by passing them to parent components through their props. Our Stateless component example above is a great representation of a Presentational Component. &lt;/p&gt;

&lt;p&gt;These are the most used components in any React-based application. I encourage you to start using it in your developments and once you get familiar with these three do a little more research and start experimenting with other types of components. &lt;/p&gt;

&lt;p&gt;As always, thank you for reading!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>React | Application Structure Part II</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Wed, 30 Dec 2020 19:45:04 +0000</pubDate>
      <link>https://forem.com/anette87/react-application-structure-part-ii-2o77</link>
      <guid>https://forem.com/anette87/react-application-structure-part-ii-2o77</guid>
      <description>&lt;p&gt;Hello developers! In my last blog, we learn more about two fundamental parts of your React App: &lt;/p&gt;

&lt;p&gt;1.node_modules &lt;br&gt;
2.public&lt;/p&gt;

&lt;p&gt;Today we will discuss one of the most important folders inside your application: &lt;strong&gt; src &lt;/strong&gt;. Short for "source", &lt;strong&gt;src&lt;/strong&gt; contains your working files that will be used later to create the build. &lt;/p&gt;

&lt;p&gt;Let's stop for a minute and talk a little bit about &lt;strong&gt;build&lt;/strong&gt;. Build is where a compiled version of assets is placed when you run &lt;code&gt;npm build&lt;/code&gt;. This is what will get delivered to the user. Something important to remember is that &lt;strong&gt;build&lt;/strong&gt; is not part of the default &lt;code&gt;create-react-app&lt;/code&gt; structure. &lt;/p&gt;

&lt;p&gt;Now, going back to &lt;strong&gt;src&lt;/strong&gt;, this folder would look something like this: &lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;App.css:&lt;/strong&gt; This file determines the styling of your application. App.css is a global styling file. &lt;code&gt;create-react-app&lt;/code&gt; uses webpack for handling all assets. Webpack offers a custom way of extending the concept of import beyond JavaScript. If a JavaScript file depends on a CSS file and you need to import the CSS from the JavaScript like this: &lt;/p&gt;

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

&lt;p&gt;That's the reason why this CSS file is global. This file is exported to your full app when added to the App.js.&lt;/p&gt;

&lt;p&gt;As well, index.css takes you to at even deeper level. By default this file contains basic fonts and margins from your application. You can think about this file like the bond of your app and just that. &lt;/p&gt;

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

&lt;p&gt;&lt;i&gt;For a React app, the best practice is to put every component in its own directory containing its corresponding JS and CSS files. The App component is the &lt;strong&gt;topmost&lt;/strong&gt; component in a React app but there aren't any predefined rules for using App.css or index.css for global CSS but me recommendation is to use your App.css as your global CSS file because that's what you would see the most.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;Like we're already talking about index.css let's talk about &lt;strong&gt;index.js&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do you remember the super important line of code in our HTML file &lt;code&gt;id-"root"&lt;/code&gt; in my last blog? Well, this file access to that root element in our DOM!&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;As you can notice above it renders our React application with the render method. Another significant part about this file is a reference to the App object imported from the App file.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import App from './App';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, let's talk about our last file: &lt;strong&gt;App.js &lt;/strong&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;App.js (second picture in this blog) is the only React component we have in the starting application. &lt;/li&gt;
&lt;li&gt;React lets you define components in two forms: &lt;strong&gt;classes&lt;/strong&gt; or &lt;strong&gt;functions&lt;/strong&gt;. In my next blog we'll talk more about components but what you need to understand is that in your component is where you start building your application for real. Everything you'll see in &lt;code&gt;localhost:3000&lt;/code&gt; lives inside your App.js. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are the fundamentals of your first React App using &lt;code&gt; create-react-app &lt;/code&gt;. All the other files are more familiar like &lt;strong&gt;images&lt;/strong&gt; and &lt;strong&gt;test&lt;/strong&gt; files for your application. Once this structure is clear to you, building components will be really easy. Trust me, you'll love how clean your code will look using the components folder but I'll talk about that next week.&lt;/p&gt;

&lt;p&gt;Thanks for reading and have a Happy New Year!&lt;/p&gt;

</description>
      <category>react</category>
      <category>beginners</category>
      <category>structure</category>
    </item>
    <item>
      <title>React | Application Structure Part I</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Mon, 21 Dec 2020 22:39:22 +0000</pubDate>
      <link>https://forem.com/anette87/react-application-structure-part-i-22b8</link>
      <guid>https://forem.com/anette87/react-application-structure-part-i-22b8</guid>
      <description>&lt;p&gt;Hello developers! In my last blog, we learn how to run your new React App and how to organize your ideas. We used &lt;code&gt;create-react-app&lt;/code&gt; to create our application and all the structure was already done for us. That's amazing and really helpful, but we need to understand the purpose of these files. Today we will discuss two of these folders:&lt;br&gt; &lt;br&gt;
&lt;i&gt; 1.node_modules &lt;/i&gt;&lt;br&gt;
&lt;i&gt; 2.public &lt;/i&gt;&lt;/p&gt;

&lt;p&gt;After your app is created the structure should look something like this:&lt;br&gt; &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pg9vg6L1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wqgkqo50an4enuv6v01r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pg9vg6L1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wqgkqo50an4enuv6v01r.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Folder &lt;strong&gt;#1&lt;/strong&gt;: &lt;strong&gt;node_modules&lt;/strong&gt; This folder is where packages installed by NPM or Yarn will live. In other words, they are just dependencies and sub-dependencies that you have added to your project. &lt;/p&gt;

&lt;p&gt;Folder &lt;strong&gt;#2&lt;/strong&gt;: &lt;strong&gt;public&lt;/strong&gt; is where your static files live. Your public folder is the root folder that gets distributed by the web server in the end. If you're not sure if a file belongs in this folder think about if the file is not imported by your JavaScript application and must maintain its file name. If the answer is yes, then your file belongs to the public folder. Files in the public directory will always keep the same file name in production. In this folder, we have one of the most important files in your application. This file is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;index.html&lt;/strong&gt;. This file is the &lt;strong&gt;ONLY&lt;/strong&gt; html page in your project. Your index.html file should look something like this:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s_JBXV2k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mgba90xe79b4dd22xqn2.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As we know JavaScrip allows us to create single-page applications. The index.html file is your single-page. We won't add &lt;strong&gt; ANY &lt;/strong&gt; HTML code here. We would do that later in different files. But how that would work you ask yourself! Can you spot this tiny line of code in the file?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;id="root"&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This line is super important because there is where you will place your React application. I would show you that later, don't you worry! One last thing. You can modify this file by importing libraries such as Bootstrap but that's the only thing you should modify. &lt;/p&gt;

&lt;p&gt;Another file on this directory worth mentioning is: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;manifest.json&lt;/strong&gt;.This is a JSON file that tells the browser about your Progressive Web Application and how it should behave when installed on a desktop or mobile device. &lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;A typical manifest file includes the app name, icons, and the URL that should be opened when the app is launched. Manifest files are supported in Chrome, Edge, Firefox, UC Browser, Opera, and the Samsung browser. Safari has partial support.&lt;/p&gt;

&lt;p&gt;One more thing you could find in this folder is the pictures for your application. Like your &lt;code&gt;create-react-app&lt;/code&gt; application is so small the files are just added to this folder because they are minimal. For example, it should look like this: &lt;/p&gt;

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

&lt;p&gt;As your app continues to grow, you will need a little more organization for your icons or images. A good idea is to create sub-folders by container, in that case, you would know exactly where that image belongs in your application. The structure should look:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
|-public
  |-images
    |-App 
      |-image1.png
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;...and that's it for today! In Part II of this series &lt;i&gt;React | Application Structure&lt;/i&gt; we would be discussing the &lt;strong&gt;src&lt;/strong&gt; folder and a couple of another important files inside your React Application. Thank you for reading and until next week!&lt;/p&gt;

&lt;p&gt;Merry Christmas! 🎄 &lt;/p&gt;

</description>
    </item>
    <item>
      <title>React | Talking about yarn and more...</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Thu, 17 Dec 2020 00:44:41 +0000</pubDate>
      <link>https://forem.com/anette87/react-talking-about-yarn-and-more-3ke7</link>
      <guid>https://forem.com/anette87/react-talking-about-yarn-and-more-3ke7</guid>
      <description>&lt;p&gt;Hello developers! Today I would like to talk about how to run your first react application and give you a few pieces of advice on how to start the creative process with a tool that would help you organize your ideas. But first, we need to talk about: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;yarn start&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In my last blog, we learn about NPM and how we need it to use &lt;code&gt;create-react-app&lt;/code&gt; but another option is using &lt;code&gt;yarn start create-react-app&lt;/code&gt;. I'm not going to start with all the technicalities and differences between &lt;code&gt;npm&lt;/code&gt; and &lt;code&gt;yarn&lt;/code&gt;. Let's say that both get the job done. If by any chance you have problems using the &lt;code&gt;npm&lt;/code&gt; package manager try using &lt;code&gt;yarn&lt;/code&gt; instead. YARN is available as an NPM package. At this point NPM should be already installed in your system so, you can install it by running the following command: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm install yarn&lt;/code&gt;&lt;/pre&gt; 

&lt;p&gt;...and that's it! I can't say one is better than the other. NPM usually is the default choice for many developers because like we discuss before installing Node.js would automatically install NPM on your system. YARN was born with the idea of fixing issues presented in NPM in the past, but doing some research online I learn the NPM and YARN are actually pretty tight in that race. If you want to learn more about the differences between YARN and NPM I strongly recommend this great &lt;a href="https://www.whitesourcesoftware.com/free-developer-tools/blog/npm-vs-yarn-which-should-you-choose/"&gt;article&lt;/a&gt; writing by Guy Bar-Gil.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now, let's go back to...&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Now that everything is amazing, properly installed and your new React app is created it's time to run your application. &lt;/p&gt;

&lt;p&gt;First, be sure you're in the correct directory. If you're using VS Code your terminal would be open by default in the right one. In your terminal, run the following command: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm start&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After that, your new React app would open in your default browser (if your default browser is not Chrome stop reading this and change it &lt;strong&gt;NOW&lt;/strong&gt;. Thank you!) Your screen should look something like this: &lt;/p&gt;

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

&lt;p&gt;Congratulations! Your new React App is installed and running, but now what? If you're anything like me you would need a place where you can organize all your extraordinary ideas for this application. For me, that place is &lt;a href="https://www.trello.com"&gt;Trello.com&lt;/a&gt; Trello is a collaboration tool that organizes your projects into boards. In one glance, Trello tells you what's being worked on, who's working on what, and where something is in a process.&lt;/p&gt;

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

&lt;p&gt;Imagine a giant whiteboard filled with lists of sticky notes! Let's be honest, you're a web developer. You own a whiteboard and hundred of sticky notes! For example, React have something called &lt;strong&gt;containers&lt;/strong&gt; &lt;i&gt;(we would talk about that pretty soon!)&lt;/i&gt;, and those containers are full of actions. Trello really helps me organize my ideas by container. Thanks to that I can work more effectively on my application and the best part, it's &lt;strong&gt;FREE&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;i&gt;If you need more help using Trello.com this &lt;a href="https://https://blog.trello.com/beginner-tips-for-using-trello"&gt;blog post&lt;/a&gt; is a most.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;And that's it for today! See you next week where we will be talking more about the parts of our React App.&lt;/p&gt;

&lt;p&gt;Adios! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>React | create-react-app </title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Fri, 11 Dec 2020 00:04:41 +0000</pubDate>
      <link>https://forem.com/anette87/react-create-react-app-55j1</link>
      <guid>https://forem.com/anette87/react-create-react-app-55j1</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NW0JEi5y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tjgo29xl1tmftq2ehcgm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NW0JEi5y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tjgo29xl1tmftq2ehcgm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Hello developers! It's has been two months since a graduated from Flatiron School. Since then I had been working on a little project using the React framework. &lt;/p&gt;

&lt;p&gt;I would be honest with you guys. After the program was over and I had my last review and final presentation my brain was so exhausted that I didn't touch my computer for two weeks. After that, I found myself super excited and full of new ideas I thought that this blog would be the perfect place to charge my new application journey. Let's learn more about React together!&lt;/p&gt;

&lt;p&gt;Ok, let's said this is the first time you're creating a React application. One of the steps that many new developers struggle with is the installation process of React. What if I tell you that's a really easy way to start your React application from the scratch? Enters &lt;strong&gt;create-react-app&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But first...&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;create-react-app&lt;/strong&gt; to work, you are going to need NPM on your system. NPM or Node Package Manager is the world's largest Software Registry and contains over 800,000 code packages. NPM is installed with Node.js which means that you have to install Node.js to get npm on your computer.&lt;/p&gt;

&lt;p&gt;Node.js is an open-source server environment. With Node.js you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;generate dynamic page content&lt;/li&gt;
&lt;li&gt;create, open, read, write, delete, and close files on the server&lt;/li&gt;
&lt;li&gt;collect form data&lt;/li&gt;
&lt;li&gt;add, delete, modify data in your database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go to the &lt;a href="https://nodejs.org/en/"&gt;official Node.js website&lt;/a&gt; to download and install Node. &lt;i&gt;Installing Node.js would automatically install NPM on your system. It's not that great?&lt;/i&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt; IMPORTANT STEPS BEFORE AND AFTER DOWNLOADING Node.Js &lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Press the "Recommended For Most Users" option.
&lt;/li&gt;
&lt;li&gt;After installing Node, start your terminal and run:
&lt;pre&gt;&lt;code&gt;node -v&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;npm -v&lt;/code&gt;&lt;/pre&gt;
&lt;code&gt;-v&lt;/code&gt; allows you to see what version is currently installed on your system of any program. The more you know!😉 
This step is really important because your version of NPM should be &lt;strong&gt; at least 5.2.0&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;3.If you have an older version of NPM, run this command to update it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm install -g npm&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After this, now we're ready to install &lt;strong&gt;create-react-app&lt;/strong&gt;. Create React App is a tool (built by developers at Facebook) that gives you a massive head start when building React apps. It saves you from time-consuming setup and configuration. You simply run one command and Create React App sets up the tools you need to start your React project. This just not saves you time but avoids mistakes in the setup process. &lt;/p&gt;

&lt;p&gt;Ok! Now, how do you install create-react-app? &lt;br&gt;
To install your app, first, go to the right directory where your app folder lives and run the following command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npx create-react-app your-app-name&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The installation process it's not short. It would take a couple of minutes. So go, grab a cup of coffee or watch a YouTube video until everything is set up for you.  After that, I would suggest going to your folder and double-check that everything is there. &lt;/p&gt;

&lt;p&gt;And that's it! Your new React Application is created and ready to rock. In the next blog, I would talk about how to run your application, and the first few steps you always need to follow at the beginning of creating a wonderful React app.&lt;/p&gt;

&lt;p&gt;See you soon! &lt;/p&gt;

</description>
      <category>react</category>
      <category>reactforbeginners</category>
      <category>myfirstreactapp</category>
    </item>
    <item>
      <title>How To Improve Your Life In 5 Months.</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Sun, 04 Oct 2020 19:42:52 +0000</pubDate>
      <link>https://forem.com/anette87/how-to-improve-your-life-in-5-months-lia</link>
      <guid>https://forem.com/anette87/how-to-improve-your-life-in-5-months-lia</guid>
      <description>&lt;p&gt;On May 4th, 2020 I started my first Coding Bootcamp with Flatiron School. I was excited, nervous, and anxious but so ready for this. Today I'm almost done with this amazing experience and I can't be more happy and grateful &lt;br&gt;
of all the things I've learned in this process. &lt;/p&gt;

&lt;p&gt;Every month we had to create an Application focusing on the subject that we had learned that month. The first one was a simple CLI Application. For that one, I created an English to Spanish Traveler translator. Our last project was React-Redux Application and for that, I created an Online Closet where you can organize your real-life closet, add pictures, and search between different categories. &lt;/p&gt;

&lt;p&gt;React-Redux Project:&lt;br&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%2Fi%2F2zjqtrimwjkbtcsxb0le.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%2Fi%2F2zjqtrimwjkbtcsxb0le.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Working on my last project I couldn't stop going back to that first month and first project. Thinking of how I would make things so much different now that I have the knowledge. It's fascinating to see how classes evolve and how we will continue to use them in other languages, frameworks, and libraries from the beginning to the end. &lt;strong&gt;Classes at the end of the day are always a template for creating objects. They encapsulate data with code to work on that data&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;CLI Project:&lt;br&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%2Fi%2Fi3x5quj360xm5qy5unf4.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%2Fi%2Fi3x5quj360xm5qy5unf4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This happens pretty much in every single project. For example, for my Rails project, I created a Funko Pop Collection App. In this App, you can create your own Funko Pop Collection, add reviews to your favorites ones. I remember when I was working on the "Add Figure To Your Collection" button in my mind the idea of not re-render the page after that and just manipulate the DOM to change what the user sees makes sense but I had no idea how to do that because at this point I was working with Rails Views and all the MCV Architecture. My app worked just fine, but I always keep that idea on the back of my mind.&lt;/p&gt;

&lt;p&gt;Rails Project:&lt;br&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%2Fi%2Foa8r4gs76and9a6a6r6u.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%2Fi%2Foa8r4gs76and9a6a6r6u.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The lessons after Rails was JavaScript and DOM manipulation. Thanks to this new JV World I learned about something called Single Page Application. &lt;strong&gt;That means this is an app or website that interacts with the web browser by dynamically rewriting the current web page with new data from the webserver, instead of the default method of the browser loading entire new pages&lt;/strong&gt;. Funny enough that was the idea I had for my Funko Pop App, but apparently my mind was a little bit ahead. &lt;/p&gt;

&lt;p&gt;Something that I learned is this past few months is that everything is possible and there's always a way to do things. After learning how to use React and Redux I know this is what I want to do every day. I love creating Apps. I enjoy the idea of thinking in ways to make those applications even better. I still have a lot to learn but if you think about it, it's really extraordinary how in coding in a way or another everything is the same but different. Five months ago I had no idea of what any of this was, but I took a leap of faith and now I can't &lt;strong&gt;stop&lt;/strong&gt; learning. Every new thing makes me a better developer and I will always thank Flatiron School for helping me start this new chapter in my life.&lt;/p&gt;

&lt;p&gt;Hi, my name is Anette Rivera and I'm a Full Stack Web Developer.&lt;/p&gt;

&lt;p&gt;Thank you for reading! :) &lt;/p&gt;

</description>
      <category>flatironschool</category>
      <category>bootcamp</category>
      <category>coding</category>
    </item>
    <item>
      <title>Redux?! How does this work?!</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Mon, 28 Sep 2020 22:41:20 +0000</pubDate>
      <link>https://forem.com/anette87/redux-how-does-this-work-5ca6</link>
      <guid>https://forem.com/anette87/redux-how-does-this-work-5ca6</guid>
      <description>&lt;p&gt;About two months ago I started my journey with JavaScript and React. I think every developer goes through the thought processes of, &lt;i&gt;"Oh! React is a great framework! I can see how this can be helpful"&lt;/i&gt;. Then comes Redux, a library that makes you doubt everything you think you have learned. Until one day you have an epiphany and EVERYTHING makes sense in your head and you finally understand that Redux makes things even easier at the end. That has been my process with React-Redux. A total roller coaster. But what is Redux?&lt;/p&gt;

&lt;p&gt;Redux is just a JavaScript library. The most important thing to know is that Redux is pure JavaScript, so it is agnostic to the framework and can be used with any framework library such as React or Angular. &lt;/p&gt;

&lt;p&gt;Redux is based on this main concepts:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A. A single &lt;i&gt;"source of truth"&lt;/i&gt;:&lt;/strong&gt;&lt;br&gt;
Redux uses a single Store to storage our state. The entire state is stored in a tree. If you think about it, in JavaScript this would be achieved using a JavaScript object. If you want, and it helps you understand it, you can think that this is what is happening behind the scenes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;B. The status is read-only:&lt;/strong&gt;&lt;br&gt;
We cannot modify the state directly, we can only read from it to represent it in the view and if we want to modify it, we have to do it through actions. But, what is an action? An action is simply a JavaScript object that includes at least one attribute ("type") that indicates the type of action we are issuing and in case there is data associated with the change or modification, an attribute ("payload") whit that data. Sounds complicated but it's not. I promise. &lt;/p&gt;

&lt;p&gt;&lt;i&gt; Example of an Action ⬇&lt;/i&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;C. Changes with pure functions: &lt;/strong&gt;&lt;br&gt;
Since we cannot modify the state directly (just through actions) and the state is stored in a single Store, to specify how to make changes in the state tree we use pure functions called reducers &lt;i&gt;"(a pure function is simply a function that returns the same result to the same input data)"&lt;/i&gt;. The reducer is just that, a function that receives two parameters, the initial state, and an action. Depending on the type of action it will perform one operation or another on the state. Always immutable, &lt;strong&gt;WE CANNOT MODIFY THE STATE&lt;/strong&gt;, if not create a copy from the previous one. This makes it easier to track down possible errors. &lt;/p&gt;

&lt;p&gt;&lt;i&gt; Example of a Reducer ⬇&lt;/i&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OGCe2unY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/urd1g251j3j6pagtcqmb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OGCe2unY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/urd1g251j3j6pagtcqmb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Redux is much more than this, but these are its basic principles. The sooner you understand how your actions and reducers work the closer you will be to being able to use such a powerful library as Redux. What Redux does in my own words is to create a maintainable application with a great architecture. You can choose to don't use it but the architecture of the application you are making will not be maintainable and if it grows it will be more difficult to make changes. That is why Redux dictates the guidelines for a good architecture, because it helps to do things right from the start.&lt;/p&gt;

&lt;p&gt;Thank you for reading! 😃&lt;/p&gt;

</description>
    </item>
    <item>
      <title>JavaScript Object-Oriented</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Sun, 30 Aug 2020 18:11:56 +0000</pubDate>
      <link>https://forem.com/anette87/javascript-object-oriented-i38</link>
      <guid>https://forem.com/anette87/javascript-object-oriented-i38</guid>
      <description>&lt;p&gt;Ok friends, let's start from the beginning right? What is object-oriented programming?&lt;/p&gt;

&lt;p&gt;The idea behind Object-Oriented programming is that you create a blueprint for the look of your "object" and call it over and over again to do whatever you want with it. Sounds helpful right? Well, it is. Every time you want to use an object, you must first create it so that it exists, and then configure its properties to use the attached functionalities. These functionalities are known as 'methods'. For example, a User object may have a get user details (in the form of a method) functionality attached. As you can see in theory is a really clear idea. &lt;/p&gt;

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

&lt;p&gt;When you start learning JavaScript the structure used to create "methods" are functions. In a function-based structure, most of the time, you will need to inject a dependency into the function for it to work. The problem with the above becomes that if you were to expand the number of functions, this can soon be quite tricky. Although initially, it seems much easier to write everything as functions and call it as needed. &lt;i&gt; Actually, that was my game plan for me JS project. If you're new at JavaScript I would suggest starting written your code like this and ones you feel confident in your code to move to classes and JSOO. Just a suggestion!&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;But... why we need an Object-Oriented structure in JavaScript if a simple function would work just as fine? Well, when you think around classes rather than a series of interconnected functions, you are &lt;strong&gt;reducing the risk and scope of failure if it occurs&lt;/strong&gt;. That's because every dependency injection creates a &lt;strong&gt;potential point of failure and as a programmer, we DON'T WANT OR NEED THAT!&lt;/strong&gt;. Not only is it time-consuming to track functions, but it is even more time and mental cost if you have to do it a dozen times for exactly the same thing. &lt;/p&gt;

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

&lt;p&gt;OOP in JavaScript can decrease the mental load and potential spaghetti relationships inherent in function-based programming. The more you learn and the more applications you build it's pretty easy to notice that JavaScript-based front-ends and back-ends apps grown in both size and complexity. When the structure of the code is easily understandable, it reduces the possibility of errors, making it easy to add new functions without breaking everything around it and that's the real beauty of JavaScript Object-Oriented Programming. &lt;/p&gt;

&lt;p&gt;Thank you for reading! :) &lt;/p&gt;

</description>
      <category>flatironschool</category>
      <category>jsproject</category>
      <category>jsoo</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Ruby on Rails &amp; Routes</title>
      <dc:creator>anette87</dc:creator>
      <pubDate>Mon, 03 Aug 2020 02:20:39 +0000</pubDate>
      <link>https://forem.com/anette87/ruby-on-rails-routes-7i2</link>
      <guid>https://forem.com/anette87/ruby-on-rails-routes-7i2</guid>
      <description>&lt;p&gt;As a developer one of the things I always look in my applications is simplicity. Simplicity in my code and a good user-friendly experience for my users. Our routes and the way we set them up would make a big difference in the overall performance of our app. &lt;/p&gt;

&lt;p&gt;Rails is a really beautiful and magical thing, and that apply to our routes too.The Rails router recognizes the URLs and sends them to the action of a controller. You can also generate routes and URLs, avoiding the need for code strings in your views (yes, this's not Sinatra anymore). In general, "routing" is how URLs are "handled" by your application. In the case of Rails, it's generally what controller and what action from that controller will handle a particular inbound URL. In Rails applications, the paths are located in the file &lt;b&gt;config/routes.rb&lt;b&gt;.&lt;/b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;A great way to set your routes is using &lt;b&gt;resources :users&lt;/b&gt;. This would automatically create seven routes (all of them connected to our &lt;b&gt;UserController&lt;/b&gt; actions. The seven routes are the following: &lt;/p&gt;

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

&lt;p&gt;Routes can be declared available only to specific members (not collections) using the method &lt;b&gt;resource&lt;/b&gt; instead of the &lt;b&gt;resources&lt;/b&gt; in &lt;b&gt;routes.rb&lt;/b&gt;. With &lt;b&gt;resource&lt;/b&gt;, an index path is not created by default, but only when one like this is explicitly requested:&lt;/p&gt;

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

&lt;p&gt;Another really useful way to organize our routes is by using nested routes. The way I use to understand nested routes is thinking about it like a really organized way to create routes based on your ActiveRecord Associations. For example, you could guess a figure &lt;b&gt;has many&lt;/b&gt; comments just to looking a route like this --&amp;gt; &lt;b&gt;"/figures/2/comments/4"&lt;/b&gt;.&lt;/p&gt;

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

&lt;p&gt;There's two really important rules I just learned using nested routes this past couple of weeks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;If we didn't specifically restrict the routes, Rails would generate all the typical routes for the nested resource as well. Be really specific and have a clear idea of how your routes should look like.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As a general rule, never generate any of the member routes when nesting. Member routes should only belong to top-level resources. There's nothing wrong with defining the same resource at two levels.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Routes can be confusing at first, but if you have a clear understanding of how to use RESTful routes and how to set up your associations from the beginning this task would be one of the most useful because your routes are that first real interaction with the logic behind your application.&lt;/p&gt;

&lt;p&gt;Thank you for reading! :)&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
