<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zucarelli</title>
    <description>The latest articles on DEV Community by Zucarelli (@rafaelzucarelli).</description>
    <link>https://dev.to/rafaelzucarelli</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%2F1272210%2F6b45f409-5070-4cfb-9145-ffef17f0abba.jpeg</url>
      <title>DEV Community: Zucarelli</title>
      <link>https://dev.to/rafaelzucarelli</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rafaelzucarelli"/>
    <language>en</language>
    <item>
      <title>HTTP and React requests</title>
      <dc:creator>Zucarelli</dc:creator>
      <pubDate>Tue, 19 Mar 2024 19:34:22 +0000</pubDate>
      <link>https://dev.to/rafaelzucarelli/http-and-react-requests-44o5</link>
      <guid>https://dev.to/rafaelzucarelli/http-and-react-requests-44o5</guid>
      <description>&lt;p&gt;&lt;strong&gt;- Using the JSON server&lt;/strong&gt;&lt;br&gt;
JSON Server is a tool that allows you to quickly create a complete and functional REST API with just a few commands, using a JSON file as a data source. It is very useful during application development, especially when you need to simulate a backend while working on the frontend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rescuing data from the "API"&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;First of all, we must have a place to save them. (&lt;strong&gt;useState&lt;/strong&gt;);&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Render the "API" call only once. (&lt;strong&gt;useEffect)&lt;/strong&gt;;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A means of making the request asynchronously. (&lt;strong&gt;Fetch API&lt;/strong&gt;);&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Saving the data via hook: "&lt;strong&gt;useState&lt;/strong&gt;"&lt;/p&gt;

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

&lt;p&gt;Rendering the API call only once with the hook: "&lt;strong&gt;useEffect&lt;/strong&gt;". Performing the asynchronous request. ("&lt;strong&gt;fetch&lt;/strong&gt;")&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbcc3qi8gjlkh8fpdnp4v.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbcc3qi8gjlkh8fpdnp4v.PNG" alt="Image description" width="751" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding Data&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To add an item, we'll need to retrieve the form data with the useState&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We have to merge the data into a function after submitting and sending a "POST" request to our API;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The process is very similar to data rescue, but now we're sending data.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Retrieving data from the form...&lt;/p&gt;

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

&lt;p&gt;Function after submit and a POST request to our API&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;The data is sent in the request body to the server. This can include form data, such as username and password, or any other type of information that the client wishes to send to the server. The server receives the POST request and processes the sent data. This may involve validating the data, saving it to a database, or performing other operations according to the application's business logic. The server responds to the POST request, usually with an HTTP status code indicating whether the operation was successful or not. The server can also send additional data in the response body if necessary.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Object Prototype - ES6</title>
      <dc:creator>Zucarelli</dc:creator>
      <pubDate>Fri, 16 Feb 2024 19:35:19 +0000</pubDate>
      <link>https://dev.to/rafaelzucarelli/object-prototype-51oe</link>
      <guid>https://dev.to/rafaelzucarelli/object-prototype-51oe</guid>
      <description>&lt;p&gt;Object.prototype is a JavaScript object that serves as the prototype of all JavaScript objects. In other words, it is an object from which other objects inherit properties and methods.&lt;/p&gt;

&lt;p&gt;When you create a JavaScript object, it automatically inherits properties and methods from Object.prototype. For example, the toString() method is inherited from Object.prototype. This means that all JavaScript objects have access to the toString() method, which is used to convert an object into a string representation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;All JavaScript objects descend from Object.prototype&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;" &lt;strong&gt;proto&lt;/strong&gt; : " (inherits the attributes of other objects)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example code:&lt;/p&gt;

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

</description>
    </item>
    <item>
      <title>Object Orientation - Pillars</title>
      <dc:creator>Zucarelli</dc:creator>
      <pubDate>Sun, 04 Feb 2024 21:04:19 +0000</pubDate>
      <link>https://dev.to/rafaelzucarelli/object-orientation-pillars-5530</link>
      <guid>https://dev.to/rafaelzucarelli/object-orientation-pillars-5530</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction of Object Orientation&lt;/strong&gt;&lt;br&gt;
Object orientation (OO) is a programming paradigm that organizes code around objects, which can contain data in the form of attributes and behaviors in the form of methods. It is crucial to modern software development as it provides a structured, modular and flexible approach that makes it easier to create efficient, sustainable and easy-to-maintain systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pillar of abstraction&lt;/strong&gt;&lt;br&gt;
The pillar of abstraction in object orientation is one of the fundamental principles that support this programming paradigm. It refers to the ability to create simplified models and conceptual representations of real-world entities, focusing on the relevant aspects and ignoring unnecessary details. Abstraction allows objects to be created with specific properties and behaviors, encapsulating internal details and interacting with each other in a modular and efficient way. This facilitates understanding, maintenance and reuse of code, promoting flexibility and scalability in object-oriented systems. Abstraction involves the creation of classes and interfaces that define the structure and behavior of objects, offering a simplified and coherent view of the system.&lt;/p&gt;

&lt;p&gt;Code example - abstraction:&lt;/p&gt;

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

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

&lt;p&gt;&lt;strong&gt;Encapsulation pillar&lt;/strong&gt;&lt;br&gt;
Encapsulation is one of the pillars of object orientation and refers to the practice of hiding the internal details of a class, protecting its attributes and methods. This is achieved by defining restricted access (public, private, protected) for class members, allowing only specific methods to access and modify this internal data. Encapsulation promotes security by preventing unauthorized access and direct manipulation of class data, and also facilitates code maintenance, since internal changes can be made without affecting other parts of the system. Furthermore, encapsulation contributes to cohesion and low coupling between classes, promoting a more modular and flexible structure.&lt;/p&gt;

&lt;p&gt;Getters and setters methods are common in object-oriented programming and provide finer control over accessing and modifying private attributes, allowing the implementation of custom logic during these operations. This contributes to encapsulation and helps maintain data integrity within a class.&lt;/p&gt;

&lt;p&gt;Getter (get):&lt;/p&gt;

&lt;p&gt;The get canalAtivo method is a getter for the private attribute _canalAtivo.&lt;br&gt;
It allows you to access active channel value from outside the class, providing a controlled way to obtain private information.&lt;br&gt;
Setter (set):&lt;/p&gt;

&lt;p&gt;The set canalAtivo(canal) method is a setter for the private attribute _canalAtivo.&lt;br&gt;
It provides a way to modify the active channel value, but may include additional logic or security checks before making the change.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Heritage Pillar&lt;/strong&gt;&lt;br&gt;
Inheritance is a fundamental pillar of object-oriented programming that allows you to create a new class, called a derived class or subclass, based on an existing class, called a base class or superclass. Inheritance facilitates code reuse by promoting the creation of a class hierarchy.&lt;/p&gt;

&lt;p&gt;Code example - heritage: &lt;/p&gt;

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

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

&lt;p&gt;&lt;strong&gt;Pillar of polymorphism&lt;/strong&gt;&lt;br&gt;
Polymorphism is a fundamental concept in object-oriented programming that refers to the ability of objects of different classes to respond uniformly to method calls with the same name. It allows the same method to be overwritten in the child object, providing flexibility and simplicity in the code.&lt;/p&gt;

&lt;p&gt;example of overriding the voo() method:&lt;/p&gt;

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

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

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