<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by David Ongaro on Medium]]></title>
        <description><![CDATA[Stories by David Ongaro on Medium]]></description>
        <link>https://medium.com/@david.ongaro?source=rss-822fd8bbd7b8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GTB6QAU23Jp5_pWG</url>
            <title>Stories by David Ongaro on Medium</title>
            <link>https://medium.com/@david.ongaro?source=rss-822fd8bbd7b8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 15:30:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@david.ongaro/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Intro to Vite]]></title>
            <link>https://medium.com/@david.ongaro/intro-to-vite-928f8b87a1dc?source=rss-822fd8bbd7b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/928f8b87a1dc</guid>
            <category><![CDATA[vitejs]]></category>
            <dc:creator><![CDATA[David Ongaro]]></dc:creator>
            <pubDate>Fri, 24 Mar 2023 07:40:36 GMT</pubDate>
            <atom:updated>2023-03-24T07:40:36.231Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GIGi13JyVAZ4o9TX" /><figcaption>Photo by <a href="https://unsplash.com/@hackcapital?utm_source=medium&amp;utm_medium=referral">Hack Capital</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Vite is a build tool and development server for modern web applications, particularly JavaScript frameworks like Vue.js or React. It was created by Evan You, the creator of Vue.js, and was designed to provide a faster and more streamlined development experience than traditional build tools like webpack.</p><p>Vite uses a development server that leverages native ES modules to offer near-instantaneous hot module replacement, which means that changes to your code can be immediately reflected in the browser without needing a full reload. This can save developers significant time and speed up the development process.</p><p>Vite also supports various other features, including code splitting, dynamic imports, and static asset optimization. It can be used with a wide range of frameworks and libraries and is compatible with both TypeScript and JavaScript projects.</p><p>Overall, Vite is a powerful and flexible tool for web developers who want to build fast, modern applications without being held back by slow build times or cumbersome development workflows.</p><p>How do Vite and React Interact?</p><p>Vite works seamlessly with React and can be used as a build tool and development server for React applications. Here’s a high-level overview of how Vite works with React:</p><ol><li>Install Vite: You can install Vite using a package manager like npm or yarn.</li><li>Set up your React project: Create a new React project or modify an existing one to use Vite. You can use a template or set up a project from scratch.</li><li>Start the development server: Run the “dev” command to start the Vite development server. This will compile your code and start a local server that serves your application.</li><li>Develop your React application: Write your React components and styles as you normally would, and Vite will automatically compile your code and update the browser in real time.</li><li>Build your application for production: When you’re ready to deploy your application, run the “build” command. Vite will bundle your code, optimize assets, and create a production-ready build that you can deploy to a server.</li></ol><p>In addition to these basic steps, Vite offers many advanced features that can help streamline your development workflows, such as hot module replacement, code splitting, and dynamic imports. Overall, Vite provides an efficient and modern development experience for React developers, helping you write better code faster.</p><p>Basic steps to create a React app with Vite from scratch:</p><p>Install Node.js: Make sure you have Node.js installed on your system. You can download it from the official website.</p><ul><li>Create a new project: Open your terminal and navigate to the directory where you want to create your project. Then run the following command to create a new project using the Vite template for React:</li></ul><pre>npm init vite@latest my-react-app --template react</pre><p>This will create a new directory called my-react-app and scaffold a basic React app with Vite.</p><ul><li>Install dependencies: Navigate into the project directory by running cd my-react-app, and then install the project dependencies by running:</li></ul><pre>npm install</pre><ul><li>Start the development server: To start the development server, run the following command:</li></ul><pre>npm run dev</pre><p>This will start the Vite development server and open your application in the browser at <a href="http://localhost:3000.">http://localhost:3000.</a></p><ul><li>Develop your React app: With the development server running, you can start writing your React components and styles in the src directory. Vite will automatically reload the browser whenever you make changes to your code.</li><li>Build your app for production: When you’re ready to deploy your app, run the following command:</li></ul><pre>npm run build</pre><ol><li>This will create a production-ready build of your app in the dist directory.</li></ol><p>That’s it! You now have a basic React app with Vite up and running. You can further customize your app by modifying the code in the src directory and exploring the various features and plugins provided by Vite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0hm8uggpsvc7QJ7Q" /><figcaption>Photo by <a href="https://unsplash.com/@majc0?utm_source=medium&amp;utm_medium=referral">Martin Brechtl</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=928f8b87a1dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CRUD Operations in Ruby-Sinatra]]></title>
            <link>https://medium.com/@david.ongaro/crud-operations-in-ruby-sinatra-c4fe86cc2452?source=rss-822fd8bbd7b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4fe86cc2452</guid>
            <category><![CDATA[rubygems]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[crud-operations]]></category>
            <dc:creator><![CDATA[David Ongaro]]></dc:creator>
            <pubDate>Mon, 12 Sep 2022 06:01:17 GMT</pubDate>
            <atom:updated>2022-09-12T06:02:09.325Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jFau5B2fY4LoWfCt" /><figcaption>Photo by <a href="https://unsplash.com/@arifriyanto?utm_source=medium&amp;utm_medium=referral">Arif Riyanto</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>According to its creators, Sinatra is a simple to use Domain Specific Langauge(DSL) for creating ruby-based web applications with ease. If you have Ruby already installed on your machine, installing Sinatra is as easy as including the gem in your project’s gem files or running this command on your terminal:</p><p>gem install sinatra</p><p>And run with:</p><pre>ruby myapp.rb</pre><p>Moving on, CRUD is an abbreviation that represents Create, Read, Update and Delete items from a database. These are the 4 basic operations an application should perform with ease. For a full-stack app, these operations involve three parts namely; the server/API with code and methods, a user interface, and a database for storing the data. In this blog, I will show you how these operations work in ruby.</p><p>Below is a table matching HTTP verbs/protocol with corresponding CRUD operations</p><figure><img alt="This a representation of CRUD operations and their corresponding HTTP methods" src="https://cdn-images-1.medium.com/max/378/1*Q3kAM1Z_tl4us8djhQEXxg.png" /></figure><h4>Read</h4><p>In your application controller, you can create a POST route for creating new items in the database either through clients like the postman or thunder client and UI frameworks like a React app. Here is an example of a post route for creating a new entry into the baked goods database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*zAVs3wn6idtmst1m8Sb0dA.png" /></figure><h4>Read</h4><p>On the other hand, a Read operation means accessing the items from a database and reading inputs in the user interface. A user can access inputs immediately after creating them for instance a new post on Twitter or by using search which allows them to filter through data and receive only what they specify.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*RbAZvudDQTeDzQKIaax__g.png" /></figure><p>Here the user will receive items based on price</p><h4>Update</h4><p>Next, we have an update operation. The update operation allows users to edit data already existing in the database such as display-name, edit posts made in apps like Telegram, and so forth, therefore, modifying said data at the end of said operation. Depending on your needs, PUT and PATCH are the HTTP verbs you can use to achieve an update. While PUT updates the entire entry, PATCH modifies just a segment of an entry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*0vo2DvzqxGEzDw5Y6VksMw.png" /><figcaption>A put route and code</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*CYbDOStrBdVkTpHxP0NGeA.png" /><figcaption>A patch route and code in ruby</figcaption></figure><h4>Delete</h4><p>To delete is to destroy an entire entry from the database and the user interface. Think of it as deleting an image or post from social media.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*NulyZ4x3CntsybNGGL5hxA.png" /><figcaption>To delete a comment we use its assigned ID to locate it and then delete it.</figcaption></figure><p>In conclusion, this piece showed the process behind the normal actions you perform on social media and similar sites.</p><ol><li>You CREATE a Facebook account and populate it with your information</li><li>You READ your posts and those of other users.</li><li>You marry and UPDATE your relationship status from single to married.</li><li>You get tired of social media and DELETE your account or those embarrassing photos from high school days.</li></ol><p>That’s all for now.</p><p>Keep Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4fe86cc2452" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s React and Why You Need it]]></title>
            <link>https://medium.com/@david.ongaro/whats-react-and-why-you-need-it-1b3e5f8f26dc?source=rss-822fd8bbd7b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b3e5f8f26dc</guid>
            <category><![CDATA[intro-to-react]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-js-framework]]></category>
            <dc:creator><![CDATA[David Ongaro]]></dc:creator>
            <pubDate>Mon, 01 Aug 2022 07:37:38 GMT</pubDate>
            <atom:updated>2022-08-01T07:37:38.780Z</atom:updated>
            <content:encoded><![CDATA[<p>React is simply a javascript library for building user interfaces. Due to its declarative nature, users find it easy to make interactive UIs using react. This also means that debugging is less painful and your code is more predictable. As its name suggests, react updates and renders as soon as you make changes.</p><p>In react, code is refactored into smaller pieces called components that handle different tasks. Think of these components as separate parts of your page such as the navbar, sear-results, maps, submit forms, and much more. These components can either be in class or function formats. functional components resemble javascript functions. However, their names must start with a capital letter as opposed to regular javascript functions. Here is an example of javascript components;</p><pre><strong>1.<em> function format - don&#39;t forget to export functional components so that they can be accessed by others.</em></strong></pre><pre>export const Examplecomponent=()=&gt;<br>{<br>    return &lt;h1&gt;Welcome Back!&lt;/h1&gt;;<br>}</pre><pre><strong>2.<em>class component - they are more complex than functions such that we can pass data between class components because they are &#39;aware&#39; of each other while functions aren&#39;t.</em></strong></pre><pre>export default class Examplecomponent extends React.Component<br>{<br>    render(){<br>          return &lt;h1&gt;Welcome Back!&lt;/h1&gt;;<br>    }<br>}</pre><pre>The above components are similar in performance and their usage varies according to the needs of our code. If we are certain that our components will be sharing significant data, we can use classes , otherwise we will use functional components because they are easier to understand.</pre><h4><strong>Rendering Components</strong></h4><p>React components are rendered using the ReactDom.render( ) method. Below is a code example</p><p>import React from &#39;react&#39;;</p><p>import ReactDOM from &#39;react-dom&#39;;</p><p>// This is a functional component</p><p>const Greeting=()=&gt;</p><p>{</p><p><strong>return</strong> &lt;h1&gt;Good Morning!&lt;/h1&gt;</p><p>}</p><p>ReactDOM.render(</p><p>&lt;Greeting /&gt;,</p><p>document.getElementById(&quot;root&quot;)</p><p>);</p><p>What’s happening here?</p><ol><li>We import React and ReactDOM first</li><li>We call ReactDOM.render()</li><li>React calls Greeting which, returns Good Morning!</li><li>Finally, ReactDOM updates the DOM with the returned element and renders it through the specified element of id ‘root’.</li></ol><h4>Why use React</h4><ol><li>It gives you a great way to structure the view layer of your app.</li><li>Its components are reusable and have their own state making them dynamic.</li><li>No need to separate logic from markup thanks to JSX (dynamic html)</li><li>React apps are faster, very interactive, and use a virtual DOM- which allows you to update parts of a page without reloading the entire page.</li><li>It is a popular framework that boasts of better performance and testing.</li></ol><h4><strong>What you need first</strong></h4><p>I strongly advise against jumping into learning React before learning and understanding JavaScript first. Understand data types, functions, asynchronous programming, data fetching, array, and object methods among others. From there, you are good to go and there is plenty of resources online for learning. Good luck and enjoy your React journey!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b3e5f8f26dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Concepts]]></title>
            <link>https://medium.com/@david.ongaro/javascript-concepts-55ac33188f2c?source=rss-822fd8bbd7b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/55ac33188f2c</guid>
            <category><![CDATA[javasript]]></category>
            <dc:creator><![CDATA[David Ongaro]]></dc:creator>
            <pubDate>Mon, 27 Jun 2022 07:57:11 GMT</pubDate>
            <atom:updated>2022-06-27T08:01:26.115Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t6_BlW2VSjhSIOvq" /><figcaption>Photo by <a href="https://unsplash.com/@lautaroandreani?utm_source=medium&amp;utm_medium=referral">Lautaro Andreani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In my opinion, HTML &amp;CSS are quite simple and fun to learn for beginners. Trouble begins when JavaScript is introduced to the equation. There is a lot of things to learn and may overwhelm a learner if the learning process is not well organized. The equality syntax can be confusing at the beginning, even I was confused by the strict equality (===)and loose equality(==)and where or when to use either. For instance if you check whether ‘45’ == 45 in JS this will return true while ‘45’ === 45 will return false because strict equality compares data types as well as the value and in our case here ‘45’ is a string while 45 is an integer hence returns false. When it comes to primitives vs objects the equality in primitives only compare the actual value of things like strings and numbers while objects look at the object in memory.</p><p>Another nightmare for beginners is context in JS, especially the keyword ‘this’. From my understanding, this references the object executing the current function. If that function is part of an object we call the function and method but if that function is a method in an object this references that object itself otherwise if that function is a regular function i.e not part of an object, this references to a global object or window in browsers</p><p>const music = {</p><p>title: ‘Narcos’ ,</p><p>play( ) {</p><p>console.log(this)</p><p>}</p><p>music.play( )</p><p>if we save this and check our console we will see our music object in the console, because play is a method in the music object, this references the object itself.</p><p>const music = {</p><p>title: ‘Narcos’ ,</p><p>play( ) {</p><p>console.log(this)</p><p>}</p><p>function Music(title) {</p><p>this.title = title</p><p>console.log(this )}</p><p>const mus = new Music (‘Dior’)</p><p>our console logs a new Music object with title set to Dior because we used the this new operator which creates an empty object {} and sets ‘this’ as in this.title = title to the new object. Had we not called this regular object without the new operator, it would have referenced to the global object and return undefined</p><p>const music = {</p><p>title: ‘Narcos’ ,</p><p>tags: [ 1, 2, 3],</p><p>showTags( ) {</p><p>this.tags.forEach (function(tag){</p><p>console.log(tag)</p><p>})</p><p>}</p><p>}</p><p>music.showTags( )</p><p>if we add this keyword to our console log we get a reference to window besides our tags because we are inside the callback which is a regular function. But if we pass this as the second argument of forEach such that</p><p>const music = {</p><p>title: ‘Narcos’ ,</p><p>tags: [ 1, 2, 3],</p><p>showTags( ) {</p><p>this.tags.forEach (function(tag){</p><p>console.log(this.title, tag)</p><p>}, this)</p><p>}</p><p>}</p><p>music.showTags( )</p><p>this refers to the parent object and will have our title display alongside our tags</p><p>However not all methods in JS will allow you to pass the this argument that way. Don’t worry too much, you can look it up (the arrow function). And if this information is too much, worry not, with practice and repetition you will get it. Also make Google your best friend.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55ac33188f2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>