<?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 JuanGarcia on Medium]]></title>
        <description><![CDATA[Stories by JuanGarcia on Medium]]></description>
        <link>https://medium.com/@theprof301?source=rss-fc7bec89bac9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*i7Sdengnjqya0Yz_jTYVLg.jpeg</url>
            <title>Stories by JuanGarcia on Medium</title>
            <link>https://medium.com/@theprof301?source=rss-fc7bec89bac9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:06:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@theprof301/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[This AI App Made My Trades Smarter]]></title>
            <link>https://medium.com/@theprof301/this-ai-app-made-my-trades-smarter-d60be8c20d9f?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d60be8c20d9f</guid>
            <category><![CDATA[social-arbitrage]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[investing]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Wed, 11 Jun 2025 22:56:20 GMT</pubDate>
            <atom:updated>2025-06-11T22:56:20.449Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DmZK_20PyCmHlfMtQwkFkg.png" /><figcaption>Hero section App</figcaption></figure><h4>Try It FREE Before Everyone Else!</h4><p>Hi everyone! 👋 <br>I’m Juan, and for the last few months I’ve been working on a <a href="https://assistantrading.social/">project</a> to improve my trading win rate by leveraging <em>Social Arbitrage</em> and <em>AI</em>. <br>I used to lose money trading — even when holding solid assets — but thanks to this project, I went from losing to winning really quickly.</p><p>This is my PnL from just the last 30 days:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oyq0VsJ88WusbO190Rf0_A.jpeg" /><figcaption>Last 30 days PnL</figcaption></figure><h3>🥳 For a limited time, you can do the same</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPdp_ZIHmRCA5CCjP4w37g.png" /><figcaption>Beta App Section</figcaption></figure><p>This <a href="https://assistantrading.social/">project</a> is still in its early stages and <strong>not officially released yet</strong>, which is why <strong>I’m offering the chance to join as a beta tester and get free early access</strong> in <strong>exchange for your feedback</strong> on the current version.</p><p>I’m also opening a <strong>waiting list </strong>for those who are interested but would prefer to wait for the full launch.</p><p>If you decide to participate, you’ll get access to all the app’s current features:</p><ol><li><strong>Global event notifications</strong> — Stay updated on all events worldwide that directly or indirectly affect the assets you’re tracking</li><li><strong>Thesis mode</strong> — Automatically validate your market hypotheses like “Bitcoin is going up” or “Tesla will drop”</li><li><strong>Sentiment trends</strong> — Track the current sentiment of most assets and companies around the globe</li><li><strong>Social Agent</strong> — A custom AI agent with access to our event graph database. It understands complex investment strategies and real-world scenarios. Ask things like: “Should I invest in Apple now?”, “When should I enter this trade?”</li></ol><p>If you’d rather wait, you can still register and you’ll receive an automatic notification when the app is fully launched.</p><h3>📰 More Information</h3><p>For more updates about the project, visit <a href="https://x.com/indie_juanE">my X account</a> or <a href="https://x.com/Social_AI25">the project’s official account</a>, where we also share predictions generated with <a href="https://assistantrading.social/">Social</a>.</p><p>Finally, a question for you, reader: <br>Would you be interested in weekly posts here sharing progress on the project and sneak peeks at upcoming features?</p><h3>🙏 Thanks for reading</h3><p>I know this post may feel a little like an advertisement — and that’s because it is. <br>This is a bootstrapped project (which means I’m funding it myself), and I’m putting my heart and soul into it. <br>If you can give it a try or help spread the word, that would mean the world to me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d60be8c20d9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I created an APP to save my trading]]></title>
            <link>https://medium.com/design-bootcamp/i-created-an-app-to-save-my-trading-ffe5ff58a0a9?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffe5ff58a0a9</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[personal-finance]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[side-project]]></category>
            <category><![CDATA[trading]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Fri, 06 Jun 2025 15:35:33 GMT</pubDate>
            <atom:updated>2025-06-06T18:05:27.286Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9acOFrvX5pd6XQF5udr_4g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@moneyphotos?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">rc.xyz NFT gallery</a> on <a href="https://unsplash.com/photos/a-laptop-computer-sitting-on-top-of-a-wooden-desk-bpZ_mOQZCiU?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>And it worked…</p><p>Something that always fascinated me was trading. I remember being 15 and seeing all these apparently successful people on the internet talking about trading. Back then I tried to become a trader myself, but it was a disaster; I got really stressed (and obsessed) and I lost all my savings trying to catch any market moves. So I came to the conclusion that it wasn’t for me… <strong>Until now</strong>.</p><p>A couple of months ago, I found myself watching YouTube and stumbled upon the unbelievable story of a guy called <strong>Jim Simons</strong>, a mathematician who beat the market by creating an incredible, unique, and mysterious AI algorithm that no one knows how it works (if you don’t know this guy, go and check his story). This got me interested, and I started investigating even more. Then I started to follow a guy called <strong>Chris Camillo</strong>, a trader who claims he made his fortune trading options and derivatives by following sentiment trends. From that author, I jumped to another one and another one and… another one. The list is huge, so I said to myself: “Why not try again?”</p><h3>The idea</h3><p>The idea was simple: create an app with all of the things I thought could help me catch market moves, sentiment trends, hidden events in the world, and game-changing information hidden in plain sight. From my previous experience, I know that technical analysis is a dark magic that for some reason doesn’t work for me, so I didn’t spend too much time building things around it.</p><p>From that was born a project that I called <em>Social</em>. A set of tools based on <strong>graph algorithms</strong>, <strong>sentiment analysis</strong>, <strong>LLMs</strong>, <strong>tons of web scraping</strong>, and <strong>internet crawling</strong>. That was my solution.</p><h3>The results</h3><p>Probably you, who are reading, are asking the obvious and most important question: <em>”Did it work?”</em> and the surprising answer is… <strong>Yes</strong>.</p><p>Crazy! I know, but I’ve been playing with this thing since the end of January and the results have been amazing. The rules I used to test the project were simple: I’m gonna give it a limited budget, and I’m gonna follow the information that Social gave me. To make everything simpler, I created an app and connected everything to an AI Agent, so I can write questions whenever I need more information or I can check the multiple dashboards, where I can inspect the sentiment trend of almost all the companies in the world and track the events that are happening everywhere.</p><h4>The first hit</h4><p>The first hit of the project was at the end of February. It was gold. The project told me that I should buy gold because the economic situation in the US wasn’t looking right. Also, there were <em>“hidden”</em> events of countries starting to demand more gold, not to mention that the sentiment in the US and the dollar weren’t that good.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ShNyYGfW0N1QYzTRAb2vRg.png" /><figcaption>PAXG Ticket</figcaption></figure><p>So I followed, and I bought approximately $300 of <strong>PAXG </strong>(a crypto that follows gold). To my surprise, gold hasn’t stopped increasing in value since February.</p><p>I also traded <strong>GME </strong>before it went vertical, <strong>AAPL</strong>, and <strong>BTC </strong>(sadly I took profit too soon in all these trades because I was testing).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mwW3pQs8AwX2gIa6WKbLNQ.png" /><figcaption>Binance Trades</figcaption></figure><h3>Current state</h3><p>The project is still in an early phase and I continue doing testing. I’m thinking of releasing the project soon in a closed beta in order for users to start testing it. I share almost daily some information gathered by Social. So, if you are interested in trading or seeing what’s going on in the market, <a href="https://x.com/Social_AI25">follow Social on X</a>.</p><h3>Conclusion</h3><p>I’ve learned a lot doing trading and working on this project, and the results got me really excited. I still need to do more testing, but I feel really motivated. If you wanna see more of the project or get more information, <a href="https://x.com/indie_juanE">I opened an X account</a> where I’ll be posting more information about this project and my other ideas.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffe5ff58a0a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/i-created-an-app-to-save-my-trading-ffe5ff58a0a9">I created an APP to save my trading</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Best Book to Learn About Algorithms and Data Structures — Take Your Developer Skills to the…]]></title>
            <link>https://medium.com/design-bootcamp/the-best-book-to-learn-about-algorithms-and-data-structures-take-your-developer-skills-to-the-04fc69750fe6?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/04fc69750fe6</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[datastrucutre]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Wed, 24 Jul 2024 12:56:54 GMT</pubDate>
            <atom:updated>2024-07-28T13:19:53.878Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c4gkNOcRcLbvjCnjIV5LEA.jpeg" /><figcaption>Picture by <a href="https://unsplash.com/@sortino">Joshua Sortino</a></figcaption></figure><h3><strong>The Best Book to Learn About Algorithms and Data Structures — Take Your Developer Skills to the Next Level</strong></h3><p>No matter if you are a software developer who wants to get into AI, frontend, backend, or databases. Wherever you go, you’ll have to deal with Data Structures and Algorithms, and learning them will not only give you an incredible advantage over your competition but also help you write better code and have a wider understanding of how the biggest and most amazing pieces of code work behind the scenes.</p><p>That’s why today I want to present to you the book that changed my life in this regard:</p><figure><a href="https://amzn.to/3LzM3Gb"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ds7Cu8EyNPPrwSSLNKSjOw.jpeg" /></a><figcaption>Book cover</figcaption></figure><p><a href="https://amzn.to/3LzM3Gb">Groking Algorithms</a> is probably the best book ever created to introduce anyone to the world of algorithms or even expand your current understanding if you already know something about it.</p><h3>The Book Structure</h3><p>This is not the common CS book that will teach with over-complicated examples or will take for granted that you have been studying this topic for the last two months in college. No, no, this book will take you from 0, giving you interesting and appealing examples, like: <strong><em>”How Facebook verifies your account, How to track the main character in a video game, how Google Maps works”</em></strong></p><p>It is worth mentioning that all the examples are fun, they are accompanied by Python code and beautiful and entertaining illustrations.</p><h3>What Can You Expect to Learn?</h3><p>Obviously, you’ll learn about algorithms, data structures, and performance. But here you have a longer and more detailed list of the main topics:</p><p>1. Binary Search<br>2. Big O Notation<br>3. How Memory Works<br>4. Arrays and Linked Lists<br>5. Recursion<br>6. Quick Sort<br>7. Hash Tables<br>8. Breadth-First Search (<strong>really helpful for AI</strong>)<br>9. Dijkstra’s Algorithm (<strong>will blow your mind and you’ll want to study math</strong>)<br>10. Greedy Algorithms<br>11. Dynamic Programming<br>12. K-Nearest Neighbors<br>13. Trees<br>14. Inverted Indexes</p><p>The book goes deep into these topics and will explain how they were developed, how they work, their applications, and their history. You’ll be amazed at how simple the author makes these topics seem.<strong> If you don’t get it with this book… I don’t know how you’ll do it</strong></p><h3>My Suggestions</h3><p>Once you start reading this book, I strongly encourage you to start practicing with code, not only in Python but in any language that you want, creating your own implementations of these algorithms.</p><p>Also, LeetCode is an excellent place to keep practicing some of the concepts that are introduced in the book. Anyway, it is most likely that after this book you’ll have to keep reading about it.</p><h3>My Experience</h3><p>I’ve been working in software development for something around 7 years now and I’ve dealt with many problems. I would have never imagined how much this book would help me. From implementing an algorithm to make searches over a custom tree to working with a RAG (Retrieval Augmented Generation) system, having to implement many algorithms to achieve the desired result. <strong>This book has changed my life, and there is no day where I regret having bought it</strong></p><h3>What Book to Read After</h3><p>I would suggest continuing with <a href="https://amzn.to/3WeiZcl">Introduction to Algorithms</a>. It is a more extensive book but will help you continue learning.</p><h3>The End</h3><p>This is a short post that has the sole intention of helping those who lack the technical knowledge that one normally acquires in college. I have many friends who are self-taught developers, and they want to acquire this information. For that reason, I wrote this post because this is something that I’ve shared with them, and it really helps.</p><p>If you found this post helpful, consider donating to me and helping me buy a book. It’s something that I really appreciate, and you have no idea how helpful it is.</p><p>[ — — — — — — — — — — — — — — — — — — — —] 0% of $60, <a href="https://buymeacoffee.com/juanemilio">Let’s buy me a book</a></p><figure><a href="https://buymeacoffee.com/juanemilio/e/277947"><img alt="" src="https://cdn-images-1.medium.com/max/389/1*rm8HadwRyQVV9J2xNPPZZg.png" /></a><figcaption>Button</figcaption></figure><p>As always, I hope you like it, and I’m reading your comments in the comment section.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04fc69750fe6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/the-best-book-to-learn-about-algorithms-and-data-structures-take-your-developer-skills-to-the-04fc69750fe6">The Best Book to Learn About Algorithms and Data Structures — Take Your Developer Skills to the…</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create Wealth and Passive Income — All That I Learned From the Millionaire Fastlane]]></title>
            <link>https://medium.com/design-bootcamp/how-to-create-wealth-and-passive-income-all-that-i-learned-from-the-millionaire-fastlane-cb1beca7c91c?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb1beca7c91c</guid>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[business-books]]></category>
            <category><![CDATA[solopreneur]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[saas]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Tue, 23 Jul 2024 02:25:00 GMT</pubDate>
            <atom:updated>2024-07-23T04:07:48.181Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PSm9gKQuvRTIfyW5jwlwNA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@djulien">Julien Riedel</a></figcaption></figure><h3>How to Create Wealth and Passive Income — All That I Learned From the Millionaire Fastlane</h3><blockquote>Wealth is a process, not an event — MJ DeMarco</blockquote><p>Today, I want to share with you all that I learned from “<a href="https://amzn.to/3LAdZtB">The Millionaire Fastlane</a>”, a book that promises to help you create wealth, but not in the traditional way. This book was written by <em>MJ DeMarco</em>, an entrepreneur who created multiple successful businesses and went from nothing to millionaire. He shares a philosophy where he tries to teach that you can be a nobody and still create an <em>”asymmetrical growing business”</em>. If this sounds interesting, keep reading.</p><blockquote>I’m a <strong>nobody</strong>. And that’s important — because you can be a “nobody” too — a <strong>nobody</strong> who lives like a king — MJ DeMarco</blockquote><h3>Lesson 1 — The Slowlane, The Sidewalk, and The Fastlane</h3><p>If you have grown up in a conservative family like mine, where there has never been too much money around, you have probably heard advice like: <em>”You need to save money”, “Don’t waste too much”, “Buy real estate”, “Get a stable job and don’t let it go”</em> and many other things like that. And although I don’t think all of this advice is necessarily wrong, there is something that MJ DeMarco tries to tell us that is true.</p><p>In the book, we are presented with the idea that wealth is not built through events but through a process that we need to endure. This process can be described as a “road trip” that we all drive, either consciously or not.</p><h4>The Slowlane</h4><p>This map is the one that most of us follow. Trying to find a stable job, working hard to climb the corporate ladder, and saving every penny we can to hopefully someday live the life that we truly want.</p><p>I don’t know how you feel when I talk about this, but personally, this is not a plan that resonates with me, nor with MJ. We can summarize his opinion and destroy this perspective with only one phrase from the book:</p><blockquote>Unfortunately, wheelchairs don’t fit in the trunks of Lamborghinis — Page 67</blockquote><h4>The Sidewalk</h4><p>This is probably the saddest of all plans. MJ DeMarco tells us that there are people who feel incapable of playing the money game, so they decide to step aside and live a life pretending to be someone they are not. Buying expensive things out of their budget, making poor decisions, and waiting for a spectacular event to happen to make them rich and full of purpose. Like winning the lottery or all of a sudden inventing something amazing that changes the world.</p><h4>The Fastlane</h4><p>Forget about funds, playing it safe, working 9–5, waiting for an exceptional event, or saving for the rest of your life, hoping someday to be happy. MJ proposes a third way, a way that can make us rich young.</p><p>The author affirms throughout the book that he spent many years trying to understand how there are people in their 20s or 30s who are rich. For sure, they didn’t do it through index funds or investing in mutual funds. So how?</p><p>He concluded that they have found a way to create asymmetrical growing ventures, capable of producing gigantic amounts of money per month, that normally at the end conclude in a <em>”Liquidation-Event”</em> (converting all their physical assets and the company itself into money).</p><p>But how can this be achieved? Keep reading…</p><h3>Lesson 2 — Create, Refine, and Systematize the Steps to Wealth</h3><p><strong>How to be rich?</strong> That’s the question that most of us are asking right now. MJ DeMarco seems to have an answer. The steps that we need to follow to be rich are described around chapter 17, and I’ve summarized them as follows:</p><p>1. Create or Solve<br>2. Sell it<br>3. Earn enough to quit<br>4. Quit<br>5. Repeat and enjoy</p><p>Probably most of the juice is in the <em>create or solve</em>. But what does it mean? This means that we need to find a problem that needs a solution, a complex and repetitive problem.</p><h4>The Virgin Ideas Are Absurd</h4><p>When we are looking for something to invent, it is really complex to come up with an original idea, and probably if you are something like me, you have found yourself amazed with an invention that you could bring to life, only to figure out a couple of minutes later that it already exists.</p><p>That’s why, when I read this phrase, I was happily surprised:</p><blockquote>They seek virgin ideas, perfect and new, ones that would be unveiled to the world in grandiose events. Rarely does that happen — Page 248</blockquote><p>The author tries to tell us something that hides right in front of us: millionaire ideas surround us all the time. The light bulb, first created in 1879, used to be expensive, energetically inefficient, and hard to produce. Now we have light bulbs that produce less heat, are more efficient, can change their color, are easier to produce, and are cheaper. <strong>That’s the heart of capitalism!!!</strong> We need to seek out those things that bother us and try to think of ways to make them better, even if there is already another solution.</p><h4>Compete with an Advantage</h4><p>Have you ever called a service and thought, <em>”Wow, I’m never calling again”?</em> That has happened to me many times. Wouldn’t it be great if the services we know and enjoy could give us better customer service? Ding ding ding, there you go. That’s something you can use to your advantage.</p><p>The book is telling us that even the smallest thing, well done, can be a big opportunity, and it’s even better if the customer doesn’t expect it. So look for things that your competition is forgetting and could be better executed.</p><h4>Execute Fast and Learn from Your Customers</h4><p>Finally, don’t waste too much time thinking about the perfect execution. Go, do it, and get feedback from your customers. They’ll teach you the next steps ahead. That’s what I did with my coffee shop, and I’m surprised how far away I was from perfection.</p><h3>Passive Income is the Key</h3><p>We already know that we need a plan, that the escape from the <strong>rat race</strong> is not through funds or savings, that we need to create something, but what? I like the analogy the book has chosen. We need a tree. A money tree. There are not many places where they can grow, and they require a substantial amount of care and effort. <strong>The places where they can grow are</strong>:</p><p>1. Rental Systems -&gt; Anything that you can lend and get paid for<br>2. Computer Systems -&gt; Any software that can make money by itself<br>3. Content Systems -&gt; Anything that distributes information e.g. A book<br>4. Distribution Systems -&gt; Any means that helps to distribute something<br>5. Human Resource Systems -&gt; A crowd of people working together to fulfill a necessity</p><p>It has to be one of these because these are the only kinds of systems that “easily” can make money on their own, even if you are in bed resting.</p><h4>Once You Have Your Tree, Save the Seeds</h4><p>Once the tree is healthy and growing, we need to take care of it. And like any good farmer, we will reap what we sow and prepare for the next season.</p><p>What I’m trying to explain is that it’s important that once the system is up and running, we need to take advantage of the money it is producing and use it to produce passive income. This applies once you reach the point where your system itself is producing a good amount of money, because remember, you won’t be rich from an index fund. This is only a way to take advantage of the money that you are not spending.</p><h3>If Everyone Is Doing It, It’s Not Worth It</h3><blockquote>I failed at network marketing four times because subconsciously, I possessed the truth: The road violated the Commandment of Entry — Page 214</blockquote><p>The commandment of entry is simple: if everyone is doing it, it’s not worth it. Think about it for a second: is everyone rich? No, most of us are poor, so if there is something easy and accessible out there, why are most of us poor? It’s because there is no such thing. This reminds me of when crypto mining exploded. I was mining, my friends were mining, an uncle of mine was mining. And you know what? Most of them are still poor.</p><p>If everyone is doing it, it’s a bad omen. Get the hell out of there.</p><h3>Get Your Free Number</h3><p>The book takes a while to get here, around chapter 37, is where it introduces the <strong>free number</strong>. This is a common concept among most entrepreneurs, which is basically how much money you need to quit your job and live the life you deserve.</p><p><strong>The steps to get your free number are</strong>:</p><p>1. Define the lifestyle: What do you want?<br>2. Assess the cost: How much do your dreams cost?<br>3. Make it real: Execute the escape</p><h4>Assessing the Cost:</h4><p>Take your cost of living (<em>CL</em>), in my case something around $1200. Yeah, I’m cheap. <br>Now do <em>CL * 1.60 = $1920</em>. This is the Cost of Living with Taxes (<em>CLT</em>). <br>If we do <em>(CLT * 12) / 0.5 = $46,080</em>, this is how much money I’m going to need to live just from my savings by putting that into some fund or bond. <br>Finally, if we do <em>CLT * 5 = $9600</em>, this is the amount of money that our business needs to return per month to keep us alive.</p><p>This is better explained in the book on page 255.</p><h3>My Conclusion</h3><p>I think “The Millionaire Fastlane” is a great book for those who are just starting in any kind of business. I feel that it spends too much time giving you the mindset you need to succeed. But besides that, the book does a great job of revealing the basics.</p><p><strong>In conclusion, if you are just starting, it’s a great place to get perspective. If you are interested, here’s the link</strong> <a href="https://amzn.to/3LAdZtB">The Millionaire Fastlane</a></p><h3>The End</h3><p>If you enjoyed the post or found it interesting, remember that you can help me with a donation. <br><strong>By the way, today is my birthday</strong><br>[ — — — — — — — — — — — — — — — — — — — — —] 0% of $60, <a href="https://buymeacoffee.com/juanemilio">Let’s buy me a book</a></p><figure><a href="https://buymeacoffee.com/juanemilio/e/277947"><img alt="" src="https://cdn-images-1.medium.com/max/389/1*rm8HadwRyQVV9J2xNPPZZg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb1beca7c91c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/how-to-create-wealth-and-passive-income-all-that-i-learned-from-the-millionaire-fastlane-cb1beca7c91c">How to Create Wealth and Passive Income — All That I Learned From the Millionaire Fastlane</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Imposter Syndrome?]]></title>
            <link>https://medium.com/design-bootcamp/what-is-imposter-syndrome-9b716178bcbf?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b716178bcbf</guid>
            <category><![CDATA[stress]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[mental-health]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 00:16:38 GMT</pubDate>
            <atom:updated>2024-07-21T09:29:34.055Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K76Z4v-gU0K0CNG4vvvtNw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@grenar">Gianfranco Grenar</a> on Unsplash</figcaption></figure><p>Have you ever feel like you have achieved more than you deserved, or maybe that the people that surround you think you are someone you think you are not? Do you fear being discover or you felt doubt about your own experience? Do you feel incompetent doing your job? If the answer to some of this questions is yes. Then you may have imposter syndrome and hopefully this post can help you.</p><blockquote>Imposter syndrome (IS) is a behavioral health phenomenon described as self-doubt of intellect, skills, or accomplishments among high-achieving individuals. <a href="https://www.ncbi.nlm.nih.gov/books/NBK585058/">National Library of Medicine</a></blockquote><p>Or in simpler words, you feel like you are doing or living a life that is not yours. Feeling that all your success is thanks to an external force, but all failures belong to you.</p><h3>How it can affect you?</h3><p>The imposter syndrome is a big problem, that is hardly mention among any space, due to the shameful nature that hides behind this phenomenal. Here are some of the effects that it can bring to the table:</p><p>1. Anxiety and fear of being discover<br>2. Job quitting<br>3. Work disatisfaction<br>4. Atychiphobia (Fear of Failure)<br>5. Achievemephobia (Fear of Success)<br>6. Depresion<br>7. Burnout</p><p>And much more. That why I decided that I wanted to write about it. All of us have suffered anxiety at some point or our life. But some of us, we have experience this phenomenal and didn’t know what to do. We didn’t even know, that this something that can be talked.</p><h3>My personal experience</h3><blockquote>According to a 2011 research published in the International Journal of Behavioral Science, an estimated <a href="https://www.tci-thaijo.org/index.php/IJBS/article/view/521/pdf?ref=teamblind.com">70 percent</a> of people experience impostor syndrome at one point in their lives. <a href="https://www.teamblind.com/blog/58-percent-of-tech-workers-feel-like-impostors/">Team Blind</a></blockquote><p>Did you know that <a href="https://www.teamblind.com/blog/58-percent-of-tech-workers-feel-like-impostors/">58% of tech workers feel like impostors</a>. I didn’t know, and I would have liked to know it, a few year ago.</p><p>This was my first serious job working for a tech company, I started as a Frontend developer and a couple of months later, nine to be exact I was working as Team Leader. It was crazy, there was people who answered to me. I was on planification meetings, directly interacting with the client proposing solutions and solving problems an bigger scale. And it’s true that I was enjoying it, at the end I was doing what I love. But there was something in the back of my mind that took a will to stop appearing, a year to be exact. The felling of my not being enough, to make things even worse, the voice wasn’t only in my mind. There was people that was furious because me, with just 9 months inside of the company was a team leader, with a higher seniority than them.</p><p>I felt anxious, at some point I consider quitting or even telling my boss that I wasn’t the right person for the position. But I decided to continue, motivated for something that my mom just to said.</p><blockquote>We are forged in the flames of the circumstances</blockquote><h3>What can help?</h3><p>Before moving on, what I would suggest is that if you are feeling like this, the best think that you can do is not come to hasty conclusions, and first of all consult a professional, a good therapist is always great.</p><h4>Introspection and self-reflection</h4><p>This is by far one of the best weapons that everybody has in their arsenal when it comes to dealing with <em>IS</em>. Just be alone, be quiet, make enough silence and time for your mind to come talk with you. Once it comes, listen and analyze and think about the things it say as objective and seriously as you can. The root of the imposter syndrome is connected with the lack of responsibility that we attribute to our self when it come to success, when you practice this exercise, try to keep that in mind.</p><h4>Challenge your inner critic</h4><p>Another way to attack the root of the problem, is looking for evidence. If you are feeling like an impostor, stop, breath, calm and then ask yourself if you have evidence to confirm what you are saying about yourself and you own success. Probably, you won’t be able to find anything worth mentioning and that is fantastic.</p><h4>Be grateful</h4><p>This is easy, but is really good and not only for people experimenting <em>IS</em>, but for everyone of us. Celebrate your milestones, celebrate your success and try to keep in mind that the most important thing in life is enjoying the travel.</p><p>In order to do this, you can keep a diary, or notes or anything really that you can comeback later and will help you to remember all the things that you have achieved. While you are writing this memories, try to keep in mind, that you need to enjoy the moment, because the goal always will move and even if you reach it, something else will come after that.</p><h4>Self compassion</h4><p>The last but not the least, try to treat yourself, with the same compassion and love that you’ll treat a friend of yours that is having a hard time. The last thing you need when you are feeling down, is yourself not helping you.</p><h3>The end</h3><p>I wanted to write this post, due to that many of us have heard before the term Imposter-Syndrome, but even then, most of us we ignore the deep meaning of it. Hopefully this post will help someone to avoid, falling into the trap of the <em>IS.</em></p><p>If you enjoyed the post, consider sharing, liking and commenting. And if was helpful in anyway, please help me to:</p><p>[ — — — — — — — — — — — — — — — — — — — — ] 0% of $60, <a href="https://buymeacoffee.com/juanemilio">Let’s buy me a book</a></p><h3>Before you go</h3><p>I almost forgot, if you need help with your personal projects, you have an idea and want to consult with someone. I have 7 years of experience as a software developer, more than 2 years playing the entrepreneurship game and trying to learn something new everyday so:</p><figure><a href="https://buymeacoffee.com/juanemilio/e/277947"><img alt="" src="https://cdn-images-1.medium.com/max/389/1*rm8HadwRyQVV9J2xNPPZZg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b716178bcbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/what-is-imposter-syndrome-9b716178bcbf">What is Imposter Syndrome?</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Has to Be Fun — How I Learn]]></title>
            <link>https://medium.com/design-bootcamp/learning-has-to-be-fun-how-i-learn-e409bd00da4d?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e409bd00da4d</guid>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[mental-health]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Wed, 17 Jul 2024 18:41:01 GMT</pubDate>
            <atom:updated>2024-07-17T20:32:36.630Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ln83sWfvBwYipQhWC1QeWg.jpeg" /><figcaption>Person walking alone</figcaption></figure><h3><strong>Learning Has to Be Fun — How I Learn</strong></h3><p>Hey 👋 I’m Juan, and lately I’ve encountered myself with a question that doesn’t stop repeating in different ways. Why don’t we learn? How do we learn? How do I learn? This is a reflection of mine where I want to share how I learn and why. So if you are interested, keep reading 👇</p><h3>Why 🤔?</h3><p>The other day I found myself arguing with my partner. We talked, and I went for a walk to think. While I was walking, this question came to my mind. Why do I always find myself arguing over the same things? Why don’t I learn? How do we learn? I started wondering, and to be honest, the only answer that I could find to this question is… because it hurts.</p><h4>Learning Always Hurts 🤕</h4><p>I remember when I started to learn how to play the piano. I was so excited. For some reason, most of the time, I have this wonderful idea in my mind where I imagine myself being awesome on the first try. But in the end, it always strikes me. It’s almost impossible to be good or at least as good as we want on the first try. If I had to compare the feeling, I would say that it is like when you like someone and your feelings are not reciprocated. It’s frustrating; it destroys you.</p><h4>How Do We Keep Going? 🚶‍♂️</h4><p>If we accept that conclusion, that learning always hurts, how is it possible that there are things that we learn and others that just don’t seem to be understandable or acquirable? That was my second thought. A couple of days later, it came to me — it’s because there are things that are worth it and some that are not.</p><p>Let’s say I have the cure for a sickness that has been torturing you for years, but the cure will make you suffer even worse pain for months. Would you take it? I say yes, but I had to think about it for a while before answering. I guess the same happens in life; sometimes there are things that are worth tolerating just because we value what is at the end of the line much more.</p><h4>What Is at the End of the Line? 🏁</h4><p>But now there’s another question (yep, another one). What’s at the end of the line and why do some of us value it so much?</p><p>When I was learning to play the piano, it was hard, harder than most of the things that I’ve done before. It’s funny because I’ve done things that most people would say are more complicated. I won against obesity and got the physique that most of us want. I learned English, some Japanese, and I’ve been learning new things almost daily for the last few years. I’ve confronted death and my social awkwardness. These are really hard things that required planning, discipline, and a ton of effort.</p><p>But most of the time, there was something bigger at the end of the line. Learning to play the piano, solve the Rubik’s cube in less than 15 seconds, or program was motivated by an ideal, a dream, or even fun. The frustration was surpassed by what was at the end.</p><p>I know this may seem obvious when we put it into words, but as you keep reading, you’ll notice how we disparage this concept when we have to learn, either from experience or because of a goal.</p><p>After analyzing all these points, I noticed that in all the hard things that I’ve conquered, I always repeat the same pattern.</p><p>When I was learning how to program, there were a bunch of things at the end of the line. I needed the money, I wanted to create things of my own, my friends were developers, and I had a dream. I’ll never forget how I started learning Japanese. I didn’t want to, but you know what I wanted? To prove my mother wrong. She told me that I couldn’t do it, that it was too hard for me, and that I would quit. Surprise, surprise, it’s the end of the year, and I’m the best student in the entire course.</p><p>So if you want to learn something and you don’t know why you are not learning or keeping up with the process, ask yourself what’s at the end of the line?</p><h3>How I Do It 🎉</h3><p>Nice, we had a beautiful walk around my past and childhood traumas. Now we can talk about how I do it. It’s worth mentioning that what I’m going to explain now are things that I noticed I do unconsciously, without looking for them. But they appear in every skill that I’ve conquered.</p><h4>Surround Yourself 🌍</h4><p>If you had peeked at my phone when I was trying to learn piano, you’d have seen that my entire YouTube feed was: “How to learn piano faster,” “How to read music sheets,” “Basic piano chords,” and so on. If you had talked to me back then, I would explain to you how I spent hours practicing.</p><p>I had my piano in my office, in front of my desk, so each time I looked away, there it was, my piano calling me. I forced myself to be obsessed with it, always thinking about it. I started taking classes, and I practiced every weekend for hours.</p><p>That’s what I mean when I say surround yourself. Give yourself the ease of always thinking about that thing that you want to conquer.</p><h4>Make the Process Fun⛷️</h4><p>Most of us come to this conclusion that it has to be hard or horrible to learn or conquer something. Why?</p><p>When I was learning how to solve the Rubik’s cube, I had to practice for hours. So each time I had to start practicing, I would have a new playlist to listen to or an interesting podcast to hear. So in that way, it was way funnier and more entertaining to practice.</p><p>But probably the best way to learn something new is by combining this new thing with some of your other passions. For example, now my girlfriend is trying to learn how to create better logos. She needs to practice quite a lot. She loves photography and social media. In fact, she is also trying to become a community manager. So I suggested that she combine the three things together, making learning all of them a much funnier and easier process.</p><p>How can she combine it? I said, take pictures of things that catch your attention when we walk on the street, make a logo with it, and upload it to social media, pretending that it is your own client that you have to manage.</p><p>Probably now, you are saying that in this case, it is easy and that you can’t combine your new skill with your current set. I would strongly disagree; you need to think outside the box. Another example would be when I was learning trading (I don’t like trading; it’s too stressful, I don’t have the mindset or the character). I was also learning programming, so I decided to venture into a world I had never visited before: trading bots with Python and cryptos. I learned three new things looking for one.</p><p>By the way, you can start a project to learn, and that doesn’t mean that you have to finish it. I see a bunch of people stressing out because they started a project to learn and didn’t finish. Why? Did you learn? If the answer is yes, great, you did it. Move on.</p><p>Last but not least, get to know yourself. For me, it is easier to learn something if I can transform it into a mechanical process that I can grind and repeat over and over again. But maybe you are more creative and enjoy learning while creating something new. Pay attention to these things and try to adapt whatever you want to learn.</p><h4>Find Competition 🏎️</h4><p>This advice is not for everyone, but just for those like me who love the motivation of knowing that out there, someone is doing better than you.</p><p>When I was learning how to solve the Rubik’s cube, there was a boy at my school, younger than me, who did it faster. I came to resent him. This was an excellent motivation. I couldn’t stop thinking about winning against him, so I practiced and practiced and practiced until the point where I was so fast that there was no way for him to win.</p><p>In the end, we never really competed. When I went looking for him to compete, he had gotten bored and stopped practicing. So the competition was always in my mind.</p><h3>Summarizing📝</h3><p>So in the end, I came to the conclusion that we all learn because we find motives that emotionally connect with us. These motives are greater than the frustration that comes with learning something new, and some ways to make your learning process easier are:</p><p>1. Systematize — Make it repeatable and create patterns to repeat.<br>2. Find motivation — Get to know yourself and ask how you learn.<br>3. Force yourself to obsess over your goal — Find a way to always think about that thing.<br>4. Introspection — Look at yourself and pay attention to your experience learning.</p><h3>Did You Enjoy It?</h3><p>If you enjoyed it and found something useful in this post, please take a minute and make a donation. You have no idea how helpful and motivating this is for me.</p><p>[ — — — — — — — — — — — — — — — — — — — ] 0% of $20, <a href="https://buymeacoffee.com/juanemilio">let’s buy me a book</a></p><p>Also, if you want to start a SAAS, need help with your code, or with your learning process, talk to me -&gt; <a href="https://buymeacoffee.com/juanemilio/e/277947">let’s talk</a>. I’m sure we can make something together.</p><p>As always, I would really appreciate it if you could follow me or give me a like.</p><h3>Credit</h3><p>Did you like the picture in the post? Why don’t you go and check out <a href="https://unsplash.com/@cedarwheeler">Cedar Wheeler</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e409bd00da4d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/learning-has-to-be-fun-how-i-learn-e409bd00da4d">Learning Has to Be Fun — How I Learn</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn React in 3 posts]]></title>
            <link>https://medium.com/design-bootcamp/learn-react-in-3-posts-ad9fb2be75c2?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad9fb2be75c2</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Wed, 17 Jul 2024 12:04:36 GMT</pubDate>
            <atom:updated>2024-07-17T13:20:59.693Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9EdoOaRVBjELq3JYJN-KcA.jpeg" /><figcaption>React Code</figcaption></figure><p>Hi! 👋 I’m Juan, I have more than 6 years of experience working with React, and I think it’s not that hard. For that reason, I’ve decided to create a series that will teach you React from 0, and if you already know React, it will help you go to the next level. We’ll talk about really basic things in depth and really advanced topics. My objective at the end of this series is to give you enough context and knowledge so you can create your own React project, like a library.</p><h4>What are we going to learn in this series?</h4><p>1. How to build a React library the easy way<br>2. Interesting React helpers and React methods<br>3. Strange exports that can make your code more reusable<br>4. File systems to organize your project<br>5. Obviously, how to build a React project <br>6. Much more…</p><h4>What level do you need to start?</h4><p>Do you know how to write code in any language? Pay attention to my words: “Know how to write code.” I didn’t say: “How to write good code.” If the answer is yes, you are good to go. You’ll start to get it sooner or later. And if you do not, leave a message with any doubt you have.</p><p>With all of this said, we can finally start.</p><h3>What’s JS and why is it amazing?</h3><p>JS is one of the greatest pieces of art ever created. It is a single-threaded, cross-platform, easy-to-use, and understandable programming language. It was primarily designed to run code on the web, inspired by its bigger brother C#, sharing many syntactical aspects (they have similar writing). It’s really helpful for projects that are just starting because, thanks to the use of an engine that implements an interpreter and a compiler, JS can run almost anywhere: your phone, your computer, your smartwatch, and your browser.</p><h4>Playing with the browser</h4><p>I’ve mentioned that JS was originally intended to run on the web and indeed, it is one of the fundamental pieces of the modern web that we all enjoy these days. Let me show an example of JS running in the browser:</p><pre>// Function to get the window size and set it into the &lt;p&gt; tag<br>function updateWindowSize() {<br> const width = window.innerWidth;<br> const height = window.innerHeight;<br> const sizeText = `Width: ${width}px, Height: ${height}px`;<br>// Get the &lt;p&gt; tag by its id<br> const windowSizeElement = document.getElementById(&#39;window-size&#39;);<br>// Set the window size text into the &lt;p&gt; tag<br> windowSizeElement.textContent = sizeText;<br>}<br>// Update window size on load<br>window.addEventListener(&#39;load&#39;, updateWindowSize);<br>// Update window size on resize<br>window.addEventListener(&#39;resize&#39;, updateWindowSize);</pre><p>Here we can see a function that gets the size of the window and sets it into a `&lt;p&gt;` tag. This is something that until recent times was only possible with JS. This is because this was the only code that was able to run on the client side.</p><p>Besides accessing the browser properties like the Window Object, JS also can modify the DOM and add elements. That enables the possibility of dynamically rendering different parts of the application. Let me show you:</p><pre>typescript<br>// Function to render a form with fields: name, last name, and password<br>function renderForm() {<br> // Create form element<br> const form = document.createElement(&#39;form&#39;);<br>// Create name field<br> const nameLabel = document.createElement(&#39;label&#39;);<br> nameLabel.textContent = &#39;Name: &#39;;<br> const nameInput = document.createElement(&#39;input&#39;);<br> nameInput.type = &#39;text&#39;;<br> nameInput.name = &#39;name&#39;;<br> nameInput.id = &#39;name&#39;;<br> nameLabel.appendChild(nameInput);<br> form.appendChild(nameLabel);<br> form.appendChild(document.createElement(&#39;br&#39;)); // Line break for better layout<br>// Create last name field<br> const lastNameLabel = document.createElement(&#39;label&#39;);<br> lastNameLabel.textContent = &#39;Last Name: &#39;;<br> const lastNameInput = document.createElement(&#39;input&#39;);<br> lastNameInput.type = &#39;text&#39;;<br> lastNameInput.name = &#39;last_name&#39;;<br> lastNameInput.id = &#39;last_name&#39;;<br> lastNameLabel.appendChild(lastNameInput);<br> form.appendChild(lastNameLabel);<br> form.appendChild(document.createElement(&#39;br&#39;)); // Line break for better layout<br>// Create password field<br> const passwordLabel = document.createElement(&#39;label&#39;);<br> passwordLabel.textContent = &#39;Password: &#39;;<br> const passwordInput = document.createElement(&#39;input&#39;);<br> passwordInput.type = &#39;password&#39;;<br> passwordInput.name = &#39;password&#39;;<br> passwordInput.id = &#39;password&#39;;<br> passwordLabel.appendChild(passwordInput);<br> form.appendChild(passwordLabel);<br> form.appendChild(document.createElement(&#39;br&#39;)); // Line break for better layout<br>// Create submit button<br> const submitButton = document.createElement(&#39;button&#39;);<br> submitButton.type = &#39;submit&#39;;<br> submitButton.textContent = &#39;Submit&#39;;<br> form.appendChild(submitButton);<br>// Append the form to the container<br> const formContainer = document.getElementById(&#39;form-container&#39;);<br> formContainer.appendChild(form);<br>}<br>// Call the function to render the form<br>renderForm();</pre><p>This is a function that is able to render a form on the screen, but probably you are thinking: <em>”Man!!! This is huge”</em> yep, it is. In fact, this function has 47 lines of code that are not easy to read.</p><h4>How’s that happening?</h4><p>If you are something like me, probably you are asking yourself: <em>”How can JS change the DOM?”</em> or even <em>”What’s the DOM?”</em> Let’s be honest, nobody is asking these questions, but stay with me. Those are great questions, let me show you:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KqTEis6ezV3AEu80dTZZkA.png" /><figcaption>DOM structure</figcaption></figure><p>This tree-like structure is the skeleton of our page, and JS is naturally prepared to interact with it.</p><h4>It’s not that good</h4><p>We’ve been seeing how amazing JS is and all the power that it has, but there’s a caveat. It’s not that good. As we already have seen, the syntax to do modifications on the DOM is kind of hard to read, easy to break, and difficult to scale into bigger ventures. Not to mention the <strong>HORRIBLE </strong>performance that comes with directly manipulating the DOM.</p><p>Each time you make a modification to the DOM, it triggers a re-rendering on the screen, which also produces recalculation of the sizes of the elements, checking on the style sheets all over again, and it’s really hard to tell the possible side effects of some modifications. For that reason, directly manipulating the DOM at a bigger scale can be really complex.</p><p>If you want to know more about it, here is an excellent resource: <a href="https://borstch.com/blog/development/performance-considerations-when-manipulating-the-dom">Performance considerations when manipulating the DOM</a>.</p><h3>What’s React and why is it amazing?</h3><p>React is a library — mark my words: <em>”A library”</em>, not a framework nor magic, <strong>Library</strong>. Great, now that we’ve made that clear, we can continue. React was created as a solution for the problems previously mentioned, trying to implement a solution that is easy to use, understand, and grow in order to create more sustainable and complex applications on the client side. But what does that mean? It means that React is easy, scalable (I might disagree with this one), and performant (Yes and no, we’ll understand it later).</p><p>Let’s see React in action:</p><pre>import React from &#39;react&#39;;<br><br>const FormComponent = () =&gt; {<br>  const handleSubmit = (e) =&gt; {<br>    e.preventDefault();<br>    // Handle form submission<br>    console.log(&#39;Form submitted:&#39;, formData);<br>  };<br><br>  return (<br>    &lt;form onSubmit={handleSubmit}&gt;<br>      &lt;label&gt;<br>        Name:<br>        &lt;input<br>          type=&quot;text&quot;<br>          name=&quot;name&quot;<br>          onChange={handleChange}<br>        /&gt;<br>      &lt;/label&gt;<br>      &lt;br /&gt;<br>      &lt;label&gt;<br>        Last Name:<br>        &lt;input<br>          type=&quot;text&quot;<br>          name=&quot;lastName&quot;<br>          onChange={handleChange}<br>        /&gt;<br>      &lt;/label&gt;<br>      &lt;br /&gt;<br>      &lt;label&gt;<br>        Password:<br>        &lt;input<br>          type=&quot;password&quot;<br>          name=&quot;password&quot;<br>          onChange={handleChange}<br>        /&gt;<br>      &lt;/label&gt;<br>      &lt;br /&gt;<br>      &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;<br>    &lt;/form&gt;<br>  );<br>};<br><br>export default FormComponent;</pre><p>This ugly piece of art is React creating the same form that we were seeing just before in plain JS. And I know, I know, many of you out there may be saying that this is not React and that React should look something more like this:</p><pre>import React from &#39;react&#39;;<br><br>const FormComponent = () =&gt; {<br>  const handleSubmit = (e) =&gt; {<br>    e.preventDefault();<br>    // Handle form submission<br>    console.log(&#39;Form submitted:&#39;, formData);<br>  };<br><br>  return (<br>    &lt;form onSubmit={handleSubmit}&gt;<br>      &lt;label&gt;<br>        Name:<br>        &lt;input<br>          type=&quot;text&quot;<br>          name=&quot;name&quot;<br>          onChange={handleChange}<br>        /&gt;<br>      &lt;/label&gt;<br>      &lt;br /&gt;<br>      &lt;label&gt;<br>        Last Name:<br>        &lt;input<br>          type=&quot;text&quot;<br>          name=&quot;lastName&quot;<br>          onChange={handleChange}<br>        /&gt;<br>      &lt;/label&gt;<br>      &lt;br /&gt;<br>      &lt;label&gt;<br>        Password:<br>        &lt;input<br>          type=&quot;password&quot;<br>          name=&quot;password&quot;<br>          onChange={handleChange}<br>        /&gt;<br>      &lt;/label&gt;<br>      &lt;br /&gt;<br>      &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;<br>    &lt;/form&gt;<br>  );<br>};<br><br>export default FormComponent;</pre><p>And you are almost right, with the little caveat that this is not React, it is React DOM (something independent from React), React and a compiler working together. Let’s try to understand.</p><h4>What’s going on?</h4><p>I know, the previous point was a little confusing, but it’s just about to make sense. Before, we need to understand how React is working behind the scenes.</p><pre>React.createElement(&#39;button&#39;, { type: &#39;submit&#39; }, &#39;Submit&#39;)</pre><p>This, my friends, is plain React. Most of the code that you will see when writing React will transform into this. And a really good question to ask now would be: <em>“What does this code do?”</em> And the answer is: It mutates the VDOM (Virtual DOM).</p><h4>What’s the VDOM?</h4><p>We mentioned before that mutating the DOM was expensive and extremely slow, and that React is the solution to this problem (one of many solutions). This is because the React method<em> “createElement”</em> doesn’t directly manipulate the DOM; it manipulates the VDOM.</p><p>The VDOM is a tree-like data structure and conceptual representation of the real DOM that keeps track of our React components, like, for example, the button that we just created. It also keeps track of metadata that helps React to more efficiently mutate the UI.</p><p>The process that React follows is: each time something changes in the UI, for example, when we mount or unmount (mount refers to inserting the component into the VDOM) our button component, it’s compared to the last VDOM render with the current version, and updates the parts affected by our actions, in this case the div element and the button. It would look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oDB_W_VLIhnQbwEVhj1gWg.png" /><figcaption>VDOM reconciliation</figcaption></figure><p>This part that I just explained here is called <em>reconciliation</em>. If you want to know more, go and check <a href="https://react.dev/learn/preserving-and-resetting-state">React documentation</a>.</p><h4>What’s React DOM?</h4><p>React DOM is a library that is mostly used with React to render elements on the screen, giving us the tools and methods required to render our components (our React code). A method that we normally use is:</p><pre>ReactDOM.createRoot(document.getElementById(&quot;root&quot;)!).render();</pre><p>This method creates the so-called <em>“mounting point”,</em> which is the basic element that will contain our entire application. In this case, and most often, our mounting point is a div with the id: <em>“root”</em>.</p><h4>What’s a compiler?</h4><p>Before some people jump to my neck, let me do a little clarification here. Explaining what a compiler is can be really complex, and in this case, it doesn’t make sense. Not to mention that the definition of a compiler and a transpiler is blurry. So for the purpose of keeping this post more understandable, I’ll keep it simple and won’t dive into the details.</p><p>Most often, you will see React and React DOM used in this way:</p><pre>const Component = () =&gt; (<br> &lt;div&gt;<br>  //our code<br> &lt;/div&gt;<br>)</pre><p>This, my friend, is JSX. And we are able to write this understandable and beautiful code because of a compiler. A compiler is a program that translates code into some other code. It can be low-level code or just any other code. It doesn’t even need to change the programming language, like in this case. We are transforming React JSX, which is just JavaScript with a special syntax, into normal JavaScript, giving us the possibility to combine a markup language like XML with JavaScript, hence the name: JSX (JavaScript XML).</p><p>There are many compilers that can transform JSX into JS, but the one that you probably are going to hear of is Babel.</p><h4>What’s the state and why should you care?</h4><p>We mentioned before that React keeps track of the modifications that we do on the VDOM, but something that I didn’t mention was that modifying the VDOM doesn’t only mean that we are going to mount or unmount parts and React is going to notice that. React also keeps track of the mutations that happen to the <strong>state</strong>.</p><p>The state is a data structure where you can store almost anything (there are some limitations, but we are going to check them in the next chapter). React keeps track of this <em>“store”</em>, and each time you modify it, it’s going to notice and will <em>reconcile</em> (if you don’t understand this term, go back to ”<em>What’s the VDOM</em>”).</p><h4>How do we manipulate the state?</h4><p>To manipulate the state, we will use the React Hook <strong>useState</strong> (Hooks are just pieces of code that execute some logic that uses React, like a function-helper but with React code). Let’s see:</p><pre>import {useState} from &#39;react&#39;<br>const Button = () =&gt; {<br> const [amount, setAmount] = useState(0)<br> const increaseAmount = () =&gt; {<br>  setAmount(amount+1)<br> }<br> <br> return &lt;button onClick={increaseAmount}&gt;This is our amount {amount}&lt;/button&gt;<br>}</pre><p>Here we are using the state to store a number that each time we click on our button will increase the amount.</p><h4>The final piece for reconciliation</h4><p>So far, we have seen that reconciliation happens when we alter the VDOM structure by mounting or unmounting, when we alter the state, and finally when we change the props of a component.</p><h4>What’s a prop?</h4><p>React was created with code-splitting in mind, so in order to make our components more flexible, we can use props. Props are just values that we pass down from one component to another. Something just like this:</p><pre>const Button = ({text, onClick}) =&gt; {<br> return &lt;button onClick={onClick}&gt;{text}&lt;/button&gt;<br>}<br>export default Button</pre><pre>import { useState } from &#39;react&#39;<br>import Button from &#39;./Button&#39;<br>const Landing = () =&gt; {<br> const [counter, setCounter] = useState(0)<br> return (<br>  &lt;div&gt;<br>    &lt;Button text=&quot;I&#39;m a button&quot; onClick={() =&gt; setCounter(counter+1)}/&gt;<br>  &lt;/div&gt;<br> )<br>}</pre><p>As you can see, we are moving the state up. This is known as lifting up the state, and also we customized our button.</p><h4>Default props:</h4><p>There are some props that come by default in React, they are really helpful</p><h4>The key</h4><pre>const ImageGrid = ({images}) =&gt; {<br>  return images.map((src) =&gt; &lt;img key={src} src={src} /&gt;)<br>}</pre><p>The key is normally used when you are doing a map to dynamically transform data into a bunch of elements, like in this case, where I’m rendering images by mapping over a list of them and I want to help React keep track of them, in case these images change. The key is always a unique identifier.</p><h4>Children</h4><p>This is used to pass a component inside another one. For example:</p><pre>const Button = ({children, onClick}) =&gt; {<br>   return &lt;button onClick={onClick}&gt;{children}&lt;/button&gt;<br>}<br>export default Button</pre><pre>const Icon = () =&gt; {<br>   return &lt;svg /&gt;<br>}<br>export default Icon</pre><pre>import Button from &#39;./Button&#39;<br>  const Landing = () =&gt; {<br>  return (<br>     &lt;div&gt;<br>        &lt;Button&gt;<br>          &lt;Icon/&gt;<br>        &lt;/Button&gt;<br>     &lt;/div&gt;<br>   )<br>}</pre><p>If you change any prop, expect React to know it. The only exception to this is when you are passing a value by reference, but we’ll talk about it in the next chapter of the series. Follow me to don’t loose it.</p><h3>Before moving on…</h3><p>If you are really enjoying this post and consider that my effort is worth promoting, take one minute to give me a hand <a href="https://buymeacoffee.com/juanemilio">buying me a coffee</a>. You have no idea how helpful and motivating this is.</p><h3>Why so much drama?</h3><p>The name of this library is really descriptive, and you are just about to understand why. We now know that React code creates a visual representation of our UI, compares it between the different updates that we can do, and updates it as efficiently as it possibly can.</p><p>But let’s be honest, isn’t this a little bit overkill to just write some weird HTML? Yes, it is, but we are not just writing weird HTML; we are overcharging it with React, giving us a powerful interface to dynamically render elements on the screen and connecting them with our JS code, all in the same place.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot;&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>  &lt;title&gt;Button and Message&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;button id=&quot;show-message-button&quot;&gt;Show/Hide Message&lt;/button&gt;<br>  &lt;div id=&quot;message-container&quot;&gt;&lt;/div&gt;<br><br>  &lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><pre>// Function to toggle the &lt;p&gt; tag with a message<br>function toggleMessage() {<br>  const messageContainer = document.getElementById(&#39;message-container&#39;);<br>  const message = document.getElementById(&#39;message&#39;);<br><br>  if (message) {<br>    // If the message exists, remove it<br>    messageContainer.removeChild(message);<br>  } else {<br>    // If the message does not exist, create and mount it<br>    const p = document.createElement(&#39;p&#39;);<br>    p.id = &#39;message&#39;;<br>    p.textContent = &#39;Hello, this is your message!&#39;;<br>    messageContainer.appendChild(p);<br>  }<br>}<br><br>// Add event listener to the button<br>const button = document.getElementById(&#39;show-message-button&#39;);<br>button.addEventListener(&#39;click&#39;, toggleMessage);</pre><p>This is all the code that we need to render a button on the screen that will work like a switch: when it’s on, it will render a message on the screen; when it’s off, it will hide it. It’s not that complex, but let’s see how this can be done with React.</p><pre>import { useState } from &#39;react&#39;<br>const MessageSwitch = () =&gt; {<br> const [show, setShow] = useState(false)<br> return (<br>  &lt;&gt;<br>   &lt;button onClick={() =&gt; setShow(!show)}&gt;<br>    {show ? &#39;Hide&#39; : &#39;Show&#39;} Message<br>   &lt;/button&gt;<br>   {<br>    show ? &lt;p&gt;Hello, this is your message!&lt;/p&gt; : &#39;&#39;<br>   }<br>  &lt;/&gt;<br> )<br>}<br>export default MessageSwitch</pre><p>Yep, this is all the code that you need. That’s why React is amazing. At this point, you should now understand what React is, what the state is, what the VDOM is, and what reconciliation is. You now have all the basics, so you are ready to start working with React.</p><h3>How to start a project?</h3><p>Probably you are asking yourself: <em>“Now I have to install React DOM, React, and Babel to start the project?”</em> Nope, there are scaffolding projects and frameworks that implement all these technologies for you.</p><h4>Vite</h4><p>If you are asking what Vite is, let’s give them the opportunity to tell you:</p><blockquote>Vite (French word for “quick”, pronounced `/vit/`, like “veet”) is a build tool that aims to provide a faster and leaner development experience for modern web projects</blockquote><p>This build tool is incredibly fast and super easy to use. It will configure a React project with the options that you choose, avoiding the need to configure a compiler, a bundler, hot reloading, and many other things. To use Vite, run the command:</p><pre>npm create vite@latest</pre><p>Insert your project name, select your framework (React), and select either JavaScript + SWC or Typescript + SWC, go into the folder, and do npm i. You should have something like this (I chose Typescript + SWC):]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*qCAQkJCMe7yaGSP3dEUm4g.png" /><figcaption>Vite basic folder structure</figcaption></figure><p>Congratulations, now let’s dive into the project:</p><h4>index.html</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B-vTOSzYxMQ9mZ2AKqHA1w.png" /><figcaption>Index HTML parts</figcaption></figure><p>We can see our mounting point and the React implementation. That’s all the HTML that the client is going to render when they first enter the application. Later, the script tag will run and the page will be populated with our React code.</p><h4>src/main.tsx</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bzv52eWdylnfl_F2IrRmHA.png" /></figure><h4>src/App.tsx</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*CpaSKtLHAfkkFget6ZuhJA.png" /><figcaption>Defaul App</figcaption></figure><p>This is the default code that comes pre-implemented with Vite. Let’s see it. To run the React application in development mode, we have to run:</p><pre>npm create vite@latest</pre><p>That will start the project on port 5173 and it will display this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*5uGKNE0xux0VUqDrTMtqqA.png" /><figcaption>Running the app</figcaption></figure><h3>Project Structure</h3><p>I remember when I was a beginner, I hated that no one told me how to structure my files, and to be honest, it took me a while to figure out a way to do it properly. There are many ways to do it, and how you do it will depend on the kind of project that you are building, but I’ll give you one that is good enough for most cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*Pu0-if0i6KXhF3Tyb7-9BQ.png" /><figcaption>Basic project structure</figcaption></figure><p>You’ll add two new folders: pages and components. In components, you are going to store the code that you are going to reuse all across the application. Something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*uteU7Z8CIGKe01XK4ChDBA.png" /><figcaption>Project structure components</figcaption></figure><p>Probably you’ll want to reuse your input and button across your application. You probably noticed that I created the component: Input, and the Logic. That’s because ideally, we don’t want our JSX and our Logic together. Let me show you how to do this:</p><pre>import { ChangeEvent, useState } from &quot;react&quot;;<br>const regex = /[!@#$%^&amp;*(),.?&quot;:{}|&lt;&gt;]/;<br>const Logic = () =&gt; {<br>   const [value, setValue] = useState(&quot;&quot;);<br>   const handleChange = (e: ChangeEvent&lt;HTMLInputElement&gt;) =&gt; {<br>     const value = e.currentTarget.value;<br>     if (regex.test(value)) {<br>       return;<br>     }<br>     setValue(value);<br>   };<br>   return { value, handleChange };<br>};<br>export default Logic;</pre><p>In the Logic component of the button, we use all the things that are not directly part of the JSX. In this case, we have a function that handles the change in the input value and changes the state. We are also validating for special characters, not setting the values if it is the case.</p><pre>import Logic from &quot;./Logic&quot;;<br>const Input = () =&gt; {<br> const { handleChange, value } = Logic();<br> return &lt;input value={value} onChange={handleChange}&gt;&lt;/input&gt;;<br>};<br>export default Input;</pre><p>And here we have our Input component with the special Logic that we wanted to implement. This is a pattern that we are going to repeat all over our application. And yes, this Logic component is some kind of custom-hook (Go back to <em>”How we manipulate the state”</em>)</p><p>Finally, in the pages folder, we will have a recursive structure (recursive means that it repeats) with folders that will describe features of the application, having on them multiple components that refer to that page specifically. Let’s see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*pgYY9ZdM1SjRx-JMQQiNwA.png" /><figcaption>Project Structure Pages</figcaption></figure><h3>Coming to an end</h3><p>If you have reached this point, it means that you now have the basics to start working with React. Go and keep practicing, creating something of your own and applying these concepts. In the next couple of days, I’m going to bring you chapter two, where I’ll talk about more complex topics and advanced techniques.</p><h3>You have doubts — Get in touch with me?</h3><p>If you have any doubts or you need help pushing your project or knowledge one step forward, contact me. I’m starting a new project where you can talk with me for an hour, and I’ll try to help you to make the progress you are looking for:</p><p><a href="https://buymeacoffee.com/juanemilio/e/277947"><strong>Get in touch</strong></a></p><h3>The end</h3><p>If you really enjoyed this post, please share it, follow, and like it. Thanks for reading and I hope I’ll see you again.</p><figure><a href="https://buymeacoffee.com/juanemilio"><img alt="" src="https://cdn-images-1.medium.com/max/545/1*0dHnc6C8ciCSz4KIBrN41w.png" /></a><figcaption>Buy me a coffee</figcaption></figure><h3>Credit</h3><p>If you like the picture of the post consider checking the work of <a href="https://unsplash.com/@lautaroandreani">Lautaro</a> his the owner.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad9fb2be75c2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/learn-react-in-3-posts-ad9fb2be75c2">Learn React in 3 posts</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You life is not complicated you are unorganized]]></title>
            <link>https://medium.com/design-bootcamp/you-life-is-not-complicated-you-are-unorganized-e33a5ce002f4?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e33a5ce002f4</guid>
            <category><![CDATA[anxiety]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[stress]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Thu, 11 Jul 2024 16:47:45 GMT</pubDate>
            <atom:updated>2024-07-12T06:15:55.548Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yLKqtB4txaBTyokqfjlO9A.jpeg" /><figcaption>Stressed person</figcaption></figure><p>Hey 👋 I’m Juan, and today I want to share something that happened to me this week. Recently, I started working in a new place, I moved, I’m working on multiple personal projects at the same time, I started writing, I’m still reading almost every day, and I’m trying to have a personal and social life. Complicated, as you may understand. I started to feel really stressed; I was losing my mind. So I did one of the things that calms me the most: go for a walk. The solution to my problem, and maybe yours too, is right below.</p><h3>Why 🤔?</h3><p>Maybe you are asking yourself why I wrote this post. For two reasons: 1st, I might forget how I organized my calendar and my routine, the mindset I need to stay calm, and why I’m doing it. 2nd, because I’m quite sure there are people out there just like me who are coming to hasty conclusions when they are just unorganized.</p><h3>How 😎?</h3><p>The system that I’m going to share is born from the combination of my own experience trying to schedule my life and the knowledge of Noah Kagan in <a href="https://www.amazon.com/-/es/Noah-Kagan/dp/059353977X">Million Dollar Weekend</a>. So let’s divide it into easy, understandable steps:</p><h4>What Do You Need to Do 🗺️?</h4><p>If you are like me or my girlfriend, you get lost among all the things you want or have to do. That’s why we need to define long-term goals that help us stay focused. We want to make a list of the things that need to be done in the future. In our case, we look 6 months ahead, but you can go even further if you want. If you don’t want to think about it, just stay with 6 months.</p><p>Great, here’s my list:</p><p>1. Write 100 posts on Medium and Dev<br>2. Finish 6 more books<br>3. Finish 3 applications<br>4. Travel around Argentina</p><p>These are some of the things that I need to finish in 6 months. I hope you did yours.</p><h4>Steps 👣</h4><p>On my list, I have four goals; you can have as many as you need or want. Now we need to divide them into things that we can repeat in order to reach our goals. In my case, it would be:</p><p>1. Work on my own applications<br>2. Write<br>3. Read</p><p>These three easy activities may seem silly at the time, but they’ll make more sense once we put everything together.</p><h4>Schedule 📅</h4><p>We have our goals, we have our steps, and we are almost there. Now we need to schedule, but before doing that, you need to make another list, yep, another one. We need to write down our goals for the end of the week. These are more specific things that should be done in the time of the steps we defined before.</p><p>In my case, for this week, I need to have done these things:</p><p>- [ ] Finish the Customers screen; it should be responsive.<br>- [ ] Connect the Customers UI with the DB.<br>- [ ] Finish the authentication.<br>- [ ] Make a list of future posts.<br>- [ ] Check for new books.</p><p>And so on… The point is, these are some of the tasks that I should finish before Saturday, and they should be done in the steps/time categories we defined before.</p><p>Connect Customers UI with the DB -&gt; Work on my own applications<br>Make a list of future posts -&gt; Write<br>Check for new books -&gt; Read</p><p>Easy, right? Now let’s give them space in our calendar, but before that, I want you to take into consideration that you should dedicate more time in your day to the activity that will get you closer to your most important goal for the next 6 months. In my case, my most important goal is finishing my applications, so I’ll spend more time working on my apps than anything else.</p><p>Finally, your calendar should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*0FaymHfQtK-Z1MkLqZ4NZg.png" /><figcaption>One day of my calendar</figcaption></figure><p>My day is not always like that, and it depends on the way I want to handle my workload.</p><h4>Special Events 🎂</h4><p>There are times when you have to do something just once. Those things are your priority number one. Put them at the top of your list, create a task on Google Calendar, and get them out of your roadmap as soon as possible. Don’t do like me because I’ve come to notice that these are things that can explode in your face if you don’t handle them on time and keep postponing them. Do you need to go to the doctor? Schedule the task, get the appointment, and go. Don’t waste peace of mind telling yourself, <em>“I’ll do it once I finish this.”</em> You and I both know that time will never come.</p><h3>Perfect It 🔁</h3><p>Every Saturday, reserve 15 or 30 minutes to check your performance over the week. Check if you could accomplish what you set out to do. If you did and felt okay with the workload, keep going. If you couldn’t finish most of the things you listed, don’t worry, you need to reschedule. Pay attention to the details and ask yourself what went wrong. Maybe you just need to move your time categories/steps in the calendar to find a better place, or maybe you need to lower your expectations. Maybe you are overestimating the amount of work you can handle.</p><p>It’s worth mentioning that you shouldn’t fill your schedule completely. You want to leave empty space for yourself, your loved ones, or the unforeseen events that will inevitably happen.</p><h3>Mindset 🧠</h3><p>As I told you at the beginning of this post, I found myself really stressed. When I finished my schedule, I felt really calm because I realized that there wasn’t as much to do as I thought. Besides that, I also realized that I had become used to overthinking what I have to do, constantly asking myself if I’m doing the right thing. We can’t control everything; it’s better to get a plan, find things that you can control, and stick to them.</p><p>I would love to create a really successful application, but I can’t really control success. Instead, I can control how many applications I create. So that’s what I do: I focus my mind and my effort on developing as many applications as I can, trying to learn as much as I can from each one of them.</p><h4>Time for Being a 👦 and Time for Being a 🤖</h4><p>There is a time to think, to feel, to analyze, and to dream, but extend that too much, and you’ll find yourself trapped in a storm in your own mind. Always looking for a solution, preventing, visualizing, analyzing, optimizing. Being a victim of your own thoughts for nothing to happen in the end. No more. I propose something different: get a dream, get a plan, get a limit or a line. Stick to your plan and do, do, and keep doing. Once you get to the line, you can start analyzing again to get a new plan, a new limit, and start all over again. I’ve found that to be the best solution for my constant and paralyzing anxiety.</p><h3>The End 🏁</h3><p>You’ve found the line, which means we’ve reached the end. Thanks for reading. If you enjoyed it, consider following me, liking, and if you really enjoyed or found it useful, please help me to buy a new book, with just $20 would be enough for me to get <a href="https://www.amazon.com/-/es/Nicolas-Cole-ebook/dp/B08GZK274F/ref=tmm_kin_swatch_0?_encoding=UTF8&amp;qid=&amp;sr=">The Art and Business of Online Writing</a></p><p>[ — — — — — — — — — — — — —— — — — — — — — — — — — — — —] <strong>0% of $20</strong></p><figure><a href="https://ko-fi.com/juanemilio"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6of395zLoDv9yx5-JIFCkQ.png" /></a></figure><p>Also, let me know if you want me to keep my posts short like this one or if you prefer them longer like before.</p><h3>Credit</h3><p>If you like the picture of the post consider checking the work of <a href="https://unsplash.com/@punttim">Tim</a> his the owner.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e33a5ce002f4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/you-life-is-not-complicated-you-are-unorganized-e33a5ce002f4">You life is not complicated you are unorganized</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[12 Lessons for a better UI — Refactoring UI The Book]]></title>
            <link>https://medium.com/design-bootcamp/12-lessons-for-a-better-ui-refactoring-ui-the-book-c0e73b77d61d?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0e73b77d61d</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Tue, 09 Jul 2024 21:31:07 GMT</pubDate>
            <atom:updated>2024-07-23T16:00:33.567Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I_Kc32xhXoh5vEfrAPWUsQ.jpeg" /><figcaption>Person reading a book</figcaption></figure><h3><strong>12 Lessons for a better UI — Refactoring UI The Book</strong></h3><p>Hello everyone, I’m Juan, and today I want to share some of the things that I’ve learned while reading <a href="https://www.refactoringui.com/">Refactoring UI</a>. It’s amazing how much you can learn from the right book.</p><p>Not so long ago, I started working on a new project of my own, and to my surprise, I found myself trapped and blocked with the UI that I was designing. I couldn’t decide on colors, sizes — basically anything important for a UI was escaping me. So I decided to do what I always do when I don’t know how to proceed: find a book that I think has the answer to my problem. Worst case scenario, I’ll learn something new. To my surprise, <em>Refactoring UI</em> wasn’t just the solution I was looking for; it also rekindled my interest in UI design. So if you need something like that, prepare yourself, because we are going to check out the most disruptive and interesting lessons I learned from this book.</p><p>From now on, I invite you to check out the book and buy it because there’s no waste. With that said, let’s proceed.</p><h3>1 — Do It and Do It Fast</h3><p>Probably the reason why this lesson struck me as so interesting is because lately, I’ve been talking and <a href="https://medium.com/@theprof301/48hs-is-all-you-need-15083345c5d5">writing</a> nonstop about the importance of finishing a project before obsessing over the details.</p><blockquote>In the earliest stages of designing a new feature, it’s important that you don’t get hung up making low-level decisions about things like typefaces, shadows, icons, etc.</blockquote><blockquote>Page 10</blockquote><p>I found this reaffirming, and not only that, but the book proposes an exercise to make this process even easier. Take a sharpie and draw on paper; it’s really hard to obsess over the details.</p><h3>2 — Not the Layout but Instead the Feature</h3><p>What is an app? Try to come up with an answer before moving on. An app is a collection of features, at least that’s what <em>Refactoring UI </em>tells us:</p><blockquote>The thing is, an “app” is actually a collection of features…</blockquote><blockquote>Page 7</blockquote><p>This answer was a breakthrough for me. It made perfect sense — we are designing an app, not a layout. So we shouldn’t waste so much time starting the house by the roof because the details will be clearer once we have a collection of features to fill that layout.</p><blockquote>The easiest way to find yourself frustrated and stuck when working on a new design is to start by trying to “design the app.” When most people think about “designing the app,” they’re thinking about the shell.</blockquote><blockquote>Page 7</blockquote><h3>3 — First in Scale of Grays</h3><p>This is something that most of us probably know but ignore, I don’t know why.</p><p>We are still in chapter one, and the book keeps telling us to stop worrying so much about things that can be polished once the features are ready. The aspect that we are <em>“neglecting”</em> now is <strong>color</strong>, and I couldn’t feel more at peace about it. I can’t even count how many times I found myself stressing over the colors of my application. So instead of spending so much time thinking about the colors, the book suggests developing the features in a scale of grays, always keeping in mind the hierarchy that we are transmitting with contrast, size, and space.</p><h3>4 — Get Some Personality</h3><blockquote>Every design has some sort of personality. A banking site might try to communicate secure and professional, while a trendy new startup might have a design that feels fun and playful.</blockquote><blockquote>Page 17</blockquote><p>This is something we normally underestimate, forgetting to choose a personality before starting to design. In my case, the application I am currently working on wasn’t looking quite right; it didn’t have any personality. Finally, I decided to go for something formal, conveying that characteristic sense of “We know what we are talking about.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zShkkgRXTd5kA5ohmg46qg.png" /><figcaption>Landing Page example</figcaption></figure><p>It’s still a work in progress.</p><h3>5 — Systematize Everything</h3><blockquote>The more systems you have in place, the faster you’ll be able to work, and the less you’ll second-guess your own decisions.</blockquote><blockquote>Page 27</blockquote><p>How many times have you found yourself asking: “What size should this be?” or maybe repeating a decision over and over again? The book strongly encourages us to develop following a system. I might add that a good solution to avoid falling into the complicated task of creating your own system is to copy someone else’s system, like the one Tailwind is using.</p><h3>6 — What’s the Priority?</h3><p>Have you felt that you don’t know why your UI seems flat? I’ve asked myself that many times. I used to think it was because of the lack of animation in my app, so I added animations. That didn’t solve it, so I thought it was the color scheme; it wasn’t. This book gave me the answer:</p><blockquote>Visual hierarchy refers to how important the elements in an interface appear in relation to one another, and it’s the most effective tool you have for making something feel “designed.”</blockquote><blockquote>Page 30</blockquote><p>There you have the answer: visual hierarchy, reducing the noise in our design, helping the user to pay attention to what is most important on the screen. Playing with contrast, color, size, and space — those are our tools to achieve it.</p><h3>Before moving on</h3><p>If you are enjoying my content or find it useful, give me a follow and leave me a comment or like — that’s always helpful. I don’t want to stop you, so enjoy the post, and thanks for reading.</p><h3>7 — Don’t Use Gray Text on Colored Backgrounds</h3><p>I’ve included this because it is an error that I used to make when trying to create hierarchy in my UI.</p><blockquote>Making the text closer to the background color is what actually helps create hierarchy, not making it light gray.</blockquote><blockquote>Page 37</blockquote><p>Just a little hint, worth mentioning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*MGR6OxQHSrBDH77JJSp1kg.png" /><figcaption>Gray text on colored background the wrong way</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*5qAfFCL5P1U0O-U8dywOow.png" /><figcaption>Gray text the right way</figcaption></figure><h3>8 — Balance Weight and Contrast</h3><p>Have you ever noticed that when you add an icon to your app, especially the ones that are filled, they jump out of the screen? Well, that’s because the icon is covering more surface in the same amount of space because it uses the empty space inside it. This can break your hierarchy, and as we saw before, it is probably the most important aspect for a UI in order to look “designed.”</p><p>To avoid this happening, we are going to reduce the contrast with the background by changing the color of the icon to a closer color to the background.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*qBBUCWIWeb34YkIJSGqXuA.png" /><figcaption>Bold Icon breaking visual hierarchy</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*1i_sh4TH95Tip9317zgCjA.png" /><figcaption>Correct visual hierarchy</figcaption></figure><h3>9 — Start with Too Much Space and Go Down</h3><blockquote>One of the easiest ways to clean up a design is to simply give every element a little more room to breathe.</blockquote><blockquote>Page 56</blockquote><p>It may sound absurd, but every time you start to design something, add a little bit more space than you would initially. For example, normally I start with padding-4 on Tailwind; now I’m starting with padding-8.</p><p>Increase your gap, increase your padding, and increase your margin. Later, you can go down, but let’s start with more empty space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*CbdtO4vwL2X-bOfl1C9h1g.png" /><figcaption>Not enough space example</figcaption></figure><h3>10 — How Much Width Do You Need?</h3><p>I love designing for mobile — it’s much easier, less space, less content. Just properly position your items on the screen, and everything works perfectly. Try to take that same approach to desktop, and surprise, surprise, your application feels strange.</p><p>The book gives us a solution:</p><blockquote>If you only need 600px, use 600px. Spreading things out or making things unnecessarily wide just makes an interface harder to interpret, while a little extra space around the edges never hurt anyone.</blockquote><blockquote>Page 65</blockquote><p>In the same way, just because you shrink your canvas doesn’t mean that everything has to behave that way. You might use full width on your navbar, but shrink your dashboard. Play with combining these ideas and remember:</p><blockquote>Instead of sizing elements like this based on a grid, give them a max-width so they don’t get too large, and only force them to shrink when the screen gets smaller than that max-width.</blockquote><blockquote>Page 77</blockquote><h3>11 — Hide Actions for Data the User Hasn’t Created</h3><p>Another thing that may be obvious but that at least in my case, I always forgot to take into consideration. Let me show you something from my application again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*akUhOE4B7c09jFFrcszppA.png" /><figcaption>Customer List</figcaption></figure><p>This is the customers’ dashboard on mobile, and this is what’s going to be displayed once the user loads data. But what is he going to see if there is no data?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*vRqZEgYyDUekDbFLDuOfjA.png" /><figcaption>Customer list empty</figcaption></figure><p>Not that pretty, right? But that’s the default state of the application. What do you say if we contemplate this state?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*_TlNi_ainkV9vZFq-GLiDQ.png" /><figcaption>Customer list with add button</figcaption></figure><p>Much better. That’s basically what the book is telling us to do — contemplate these little but important states.</p><h3>12 — Use Fewer Borders</h3><blockquote>When you need to create separation between two elements, try to resist immediately reaching for a border.</blockquote><blockquote>Page 206</blockquote><p>Using borders can add noise to the UI, something that we are trying to avoid. So instead of adding borders, a better approach would be:</p><blockquote>What better way to create separation between elements than to simply increase the separation?</blockquote><blockquote>Page 209</blockquote><p>That extra space automatically causes the visual effect of differentiation between elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*G-MaFCwFu8FiHJUkj-1RtA.png" /><figcaption>Border adding noise to the UI</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*E4AzoN1T3l1xReVc9vUUMw.png" /><figcaption>Removing borders and noise</figcaption></figure><h3>Wrapping Up</h3><p>I hope you find this post useful. This was an exercise for myself, trying to summarize a 300-page book into the things that were most helpful for me. Originally, this post was going to have 25 lessons, but I think it’s better if I leave it at just 12 lessons because these are the most helpful, at least for me.</p><p>Once again, I invite you to buy the book because it has a lot more information and beautiful examples than the ones I mentioned here. So please take a <a href="https://www.refactoringui.com/">look</a>.</p><h3>Before You Go</h3><p>Thanks for reading. If you enjoyed it, consider following me, liking, and if you really enjoyed or found it useful, please help me to buy a new book, with just $20 would be enough for me to get <a href="https://www.amazon.com/-/es/Nicolas-Cole-ebook/dp/B08GZK274F/ref=tmm_kin_swatch_0?_encoding=UTF8&amp;qid=&amp;sr=">The Art and Business of Online Writing</a></p><p>[ — — — — — — — — — — — — — — — — — — — — ] <strong>0% of $20, </strong><a href="https://buymeacoffee.com/juanemilio"><strong>let’s buy me a book</strong></a></p><figure><a href="https://buymeacoffee.com/juanemilio/e/277947"><img alt="" src="https://cdn-images-1.medium.com/max/389/1*rm8HadwRyQVV9J2xNPPZZg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0e73b77d61d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/12-lessons-for-a-better-ui-refactoring-ui-the-book-c0e73b77d61d">12 Lessons for a better UI — Refactoring UI The Book</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clean Code in React]]></title>
            <link>https://medium.com/@theprof301/clean-code-in-react-a31f50cafae5?source=rss-fc7bec89bac9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a31f50cafae5</guid>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[frontend]]></category>
            <dc:creator><![CDATA[JuanGarcia]]></dc:creator>
            <pubDate>Wed, 03 Jul 2024 14:48:47 GMT</pubDate>
            <atom:updated>2024-07-03T14:48:47.854Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fl_PXqk7cf5QFRJKsV7BJg.png" /><figcaption>Clean Code presentation</figcaption></figure><p>Hello everyone, I’m Juan, and today I want to share with you some tips and tricks that I use to write more reusable code. For the past 2 weeks, I’ve been writing about how to develop projects faster and how it’s irrelevant to spend too much time looking for the perfect code at the outset of the project. Although, you are not always going to be working on your own projects, and sometimes you won’t be in a rush. Or maybe, just maybe, you are one of those accountable developers who, after spending time creating something amazing in just <a href="https://dev.to/juanemilio31323/48hs-is-all-you-need-39fa">48 hours</a> and applying the <a href="https://dev.to/juanemilio31323/how-i-build-projects-faster-my-stack-and-strategies-3hpg">strategies</a> that I shared, now you are at the point where you have to fix the mess that you’ve created, developing as fast as you could.</p><p>The example project that I’m going to use is React, but you can apply most of these things practically anywhere you want. I’m going to be showing folder structures, mentioning the architecture that I’m following, and also providing code snippets with explanations and examples of multiple cases.</p><h3>What is going on with the industry?</h3><p>I’ve been lucky, and thanks to that I’ve worked at companies of different sizes and styles, some bigger, some smaller, but in all of them, I saw a pattern that repeats everywhere: the code is broken. No structure whatsoever — logic, styles, types, everything in the same place. That might not be a problem when you just have a bunch of files, but when your codebase is gigantic, it is really easy to make it impossible to grow or sustain over time.</p><p>Right now, I’m working for a huge company with over 29,000 employees. You wouldn’t expect a company like this to make the mistakes that I was describing, but it does. After talking to people who theoretically know how to lead a project and help sustain a readable and scalable codebase, I came to the conclusion that most of us lack the knowledge or interest, or both, when it comes to structuring the code. Hopefully, this post will help someone out there write better code and know how to sustain a project over time.</p><h3>The architecture that I use — let’s scream</h3><p>Hopefully, you’ve heard about this architecture before. It’s called <em>Screaming Architecture</em>, and the name is no joke — it literally screams at you. When you enter the project, it perfectly summarizes what’s going on without needing you to run the project. Let me show you:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*pS4nO93AMbUKQFi8d5HsnA.png" /><figcaption>Basic folder structure</figcaption></figure><p>It’s worth mentioning that I made some modifications to the <em>Screaming Architecture</em> to better suit my needs, and that is something you can do too. As always, there is no perfect solution, just solutions that may adapt better to your specific case. Feel free to keep the things that work best for you and discard the rest. But when you do it, be honest with yourself and ask the following question: “Am I really doing this because it is better or just because I don’t want to learn something new?”</p><h4>Explaining the basic structure:</h4><p>In the <em>components</em> folder, you’ll create all the components that you need to reuse across your application. These are not specific components, and if you are going to put it there, it is because you are already using that component and you want to reuse it somewhere else.</p><p>In the <em>interfaces </em>folder, you’ll define all your types. We are doing it this way because most of the time, you are sharing types across your entire application, so it doesn’t make much sense to me to have the types in a deeper folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*nkuvPazIhO_yIe3dNRIWig.png" /><figcaption>Interfaces folder</figcaption></figure><p>Finally, in the <em>features </em>folder, you’ll have most of the code, following a recursive structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*Eqgku-J14921ZmE2KQgzoQ.png" /><figcaption>Components folder</figcaption></figure><p>As you can probably see here, we are creating a <em>Logic </em>file because we don’t want the logic of our application leaking into our visual components. Let me show you an example in <em>React </em>to see how this works. The component that I’m going to show you is <em>Window</em>. It renders on the screen the Window’s width of our user. You’ll notice that we have almost no logic here, just a <em>&lt;p&gt;</em> tag that is returning the <em>width size</em> of the screen.</p><pre>import Logic from &quot;./Logic&quot;;<br>const Window = () =&gt; {<br> const { size } = Logic();<br> return &lt;p&gt;{size}&lt;/p&gt;;<br>};<br>export default Window;</pre><p>And here’s the logic:</p><pre>import { useState, useEffect } from &quot;react&quot;;<br>const Logic = () =&gt; {<br> const [size, setWindowSize] = useState(0);<br>useEffect(() =&gt; {<br> // get the windows width<br> setWindowSize(window.screen.width);<br> }, []);<br>return { size };<br>};<br>export default Logic;</pre><p>We have successfully isolated our logic and our view. There will be people reading this and thinking that this is similar in some ways to the <a href="https://developer.mozilla.org/es/docs/Glossary/MVC">Model View Controller</a> pattern, and they are correct. This is really helpful and most of the time will avoid having a file that is overwhelmingly huge to read. But this is not a silver bullet, and there will be cases where you’ll have to take other approaches. So let’s see other concepts and examples.</p><h3>Abstraction and Encapsulation</h3><p>When I started programming, I remember that one of the things that I hated the most was <em>OOP (Object-Oriented Programming)</em>. For some reason, I couldn’t get it. Most of the time, I found myself asking why I would ever write something like that. At some point in my life, I realized that <em>OOP </em>was amazing and really helpful. Concepts like <em>SOLID </em>or <em>Abstraction </em>were pillars of any <em>clean code</em>. So for that reason, before moving to some code snippets, I consider it appropriate to make a stop on some of those concepts.</p><h4>Abstraction</h4><p>It is by far one of the most important things on the priority list when it comes to writing the best code possible, and also most of the time, it’s one of the most forgotten. I’ve seen people who write code that astonishingly solves the problem they are presented with, but when you start to take a deeper look and ask yourself (or them) how this is going to be reusable, you find no answer. Most of the time, that is due to a lack of understanding of the <em>Abstraction </em>principle.</p><p>Abstraction can be understood as the capacity to ignore the obvious and put the necessary attention on the more general aspects of the things that we are confronting (the big picture). If you are trying to describe a glass of water, you may say that: <em>”it is a piece of transparent material, containing water”</em> and indeed, that would be correct… on the small picture, but useless on the big picture. Instead, we can say: <em>”it is a piece of material, with some geometry, restrained to a structure able to contain liquids, with a color and transparency determined.”</em> The second description is able to generalize a lot better than the first one, giving us the opportunity to use the same description for many things. This is <em>Abstraction</em>, the skill to see the <em>“big picture”.</em> Work on it, write code thinking about it, and you from the future and the people who will have to work with you will be grateful.</p><p>Do you see any <em>Abstraction </em>in the previous example? It has, but it might be hard to see in its current state. Let me make a little change and see if you get it:</p><pre>import { useState, useEffect } from &quot;react&quot;;<br>const useWindowSize = () =&gt; {<br> const [size, setWindowSize] = useState(0);<br>useEffect(() =&gt; {<br> // get the windows width<br> setWindowSize(window.screen.width);<br> }, []);<br>return { size };<br>};<br>export default useWindowSize;</pre><p>Now instead of “Logic,” we have <em>useWindowSize</em>. Separating the logic from the view gives us the opportunity to see that we have a piece of code that is reusable. Now that we have this custom hook that we can reuse and generalize a lot better, what do you think if we move it to the <em>utils/</em> folder, so we can reuse it later?</p><h4>Encapsulation</h4><p>Would you give anyone entire access to your phone? Most likely you said no; otherwise, you are crazy since with that, any person would be able to enter your bank account and personal contacts list. We don’t want that to happen, so we’ll let <strong>some</strong> people <strong>access </strong>some part of our phone. We won’t expose our entire phone to everybody. This, my dear friend, in an intricate and funny way, is <em>Encapsulation</em>. You could summarize it as:<em> ”Some can see and touch it; some just can see it.”</em></p><p>Great, this is helpful in many ways for your code. It becomes handy, especially when you are working with too many people or when you have code that is going to be used by someone else, like in the case of my <a href="https://www.npmjs.com/package/smart-layout">React Library</a>.</p><p>Now we understand what <em>Encapsulation </em>is. Do you see it applied in any way in our <em>useWindowSize</em>? Yes! You got it. We are keeping <em>setWindowSize</em> private, just making it accessible to the code inside of <em>useWindowSize </em>and no one else. That’s great because in that way, no one will be able to alter the window size besides the logic of our code, making it more secure and predictable.</p><h3>Finally — Code Snippets</h3><p>Sorry for the stop on <em>OOP </em>concepts, but it’s necessary. It’s amazing how those two concepts can</p><p>change your life. With the new knowledge and understanding that we now have, we’ll be able to better appreciate the code that we are going to see.</p><h4>I haven’t seen it anywhere else</h4><p>The code that I’m going to show you is something that I’ve been using maybe too much lately and that, for some reason, no one is talking about. I’ll give you context. Have you ever found yourself using a perfect and reusable component, but each time you have to reimplement some specific logic because you need to access that from a higher component? No? Maybe just me… Anyway, let’s see the solution.</p><pre>tsx<br>type fields = &quot;text&quot; | &quot;image&quot; | &quot;number&quot;<br>interface ModalProps {<br> show: boolean;<br> fields: fields[]<br>}<br>const Modal = ({ show, fields }: ModalProps) =&gt; (<br> return show ? &lt;div className=&quot;modal&quot;&gt;<br> {fields.map((field) =&gt; {<br> // Modal code…<br> }}<br> &lt;/div&gt; : &#39;&#39;<br>)<br>const ImageGallery = () =&gt; {<br> const [show, setShow] = useState(false)<br> const images = […]<br> return (<br> &lt;&gt;<br> &lt;Modal show={show} fields={[&quot;image&quot;, &quot;text&quot;]}/&gt;<br> {images.map((image, i) =&gt; {<br> &lt;img src={image} onClick={() =&gt; setShow(true)}/&gt;<br> })}<br> &lt;/&gt;<br> )<br>}</pre><p>Perfect, we have an <em>ImageGallery </em>that is using our <em>“beautiful”</em> <em>Modal</em>. In this case, imagine that the modal is dynamically creating a form to upload an image with a description. Now let’s say that I want to add another page similar to <em>ImageGallery</em>, maybe a <em>Comments </em>section. I’ll have to re-write the <em>show </em>logic. Let’s try to avoid it:</p><pre>type fields = &quot;text&quot; | &quot;image&quot; | &quot;number&quot;<br>interface ModalProps {<br> fields: fields[]<br>}<br><br>const ModalHandler = () =&gt; (<br> const [show, setShow] = useState(false)<br> const Modal = ({ fields }: ModalProps) =&gt; (<br>   show ? &lt;div className=&quot;modal&quot;&gt;<br>     {fields.map((field) =&gt; {<br>     // Modal code…<br>     }}<br>   &lt;/div&gt; : &#39;&#39;)<br> return { Modal, show, setShow }<br>)<br><br>const ImageGallery = () =&gt; {<br> const { show, setShow, Modal } = ModalHandler()<br> const images = […]<br> return (<br>   &lt;&gt;<br>     &lt;Modal fields={[&quot;image&quot;, &quot;text&quot;]}/&gt;<br>     {images.map((image) =&gt; {<br>       &lt;img src={image} onClick={() =&gt; setShow(true)}/&gt;<br>     })}<br>   &lt;/&gt;<br> )<br>}<br><br>const Comments = () =&gt; {<br> const { show, setShow, Modal } = ModalHandler()<br> const comments = […]<br> return (<br>   &lt;&gt;<br>     &lt;Modal fields={[&quot;text&quot;]}/&gt;<br>       {comments.map((comment) =&gt; {<br>         &lt;p onClick={() =&gt; setShow(true)}&gt;<br>           {comment} <br>         &lt;/p&gt;<br>       })}<br>   &lt;/&gt;<br> )<br>}</pre><p>We did it! In this case, it is an overkill scenario because it is just a show and <em>setShow </em>that may be arguably re-implemented in every case, but the important thing is the concept. With this approach, we can create more reusable components, and at least for me, it is more readable than the <em>composition pattern</em>. Speaking of which, why don’t we take a look:</p><h4>Composition Pattern</h4><p>Let’s create a grid to preview images:</p><pre>const ImageGrid = ({images}) =&gt; {<br> const handleAnimations = useCallBack(() =&gt; {<br>  ...<br> }, [])<br><br> useEffect(() =&gt; {<br>  handleAnimations()<br> }, [])<br><br> const complexGridLogic = () =&gt; {<br>  ...<br> }<br>  <br> return (<br>  &lt;div className=&quot;magic-grid&quot;&gt;<br>   {complexGridLogic()}<br>   {images.map((image, i) =&gt; {<br>    &lt;div className=&quot;animated-container&quot; id={`animate-${i}`}&gt;<br>     &lt;img src={image}/&gt;<br>    &lt;/div&gt;<br>   })}<br>  &lt;/div&gt;<br> ) <br>}</pre><p>Great, we have our <em>ImageGrid </em>(again, it is just a concept). It will mount images and then animate them. Also, it has a <em>”complexGridLogic”</em>. Now let’s say that I want a <em>CommentsGrid</em> with extremely similar behavior. What a problem. Let’s see how the <em>Composition Pattern</em> can save us:</p><pre>const AnimatedContainer = ({children, id}) =&gt; {<br> const handleAnimations = useCallBack(() =&gt; {<br>  ...<br> }, [])<br><br> useEffect(() =&gt; {<br>  handleAnimations()<br>  ...<br> }, [])<br><br> return &lt;div className=&quot;animated-container&quot; id={id}&gt;{children}&lt;/div&gt;<br>}<br><br>const MagicGrid = ({children}) =&gt; {<br> const complexGridLogic = () =&gt; {<br>  ...<br> }<br> return (<br>  &lt;div className=&quot;magic-grid&quot;&gt;<br>   {complexGridLogic()}<br>   {children}<br>  &lt;/div&gt;<br> ) <br>}<br><br>const ImageGallery = ({images}) =&gt; {<br> return (<br>  &lt;MagicGrid&gt;<br>   {images.map((image) =&gt; (<br>    &lt;AnimatedContainer id={image}&gt;<br>     &lt;img src={image}/&gt;<br>    &lt;/AnimatedContainer&gt;<br>   ))}<br>  &lt;/MagicGrid&gt;<br> )<br>}<br><br>const CommentSection = ({comments}) =&gt; {<br> return (<br>  &lt;MagicGrid&gt;<br>   {comments.map((comment) =&gt; (<br>    &lt;AnimatedContainer id={comment}&gt;<br>     &lt;p&gt;{comment}&lt;/p&gt; <br>    &lt;/AnimatedContainer&gt;<br>   ))}<br>  &lt;/MagicGrid&gt;<br> )<br>}</pre><p>I see it and I love it. What a wonderful world it would be if everyone cared as much as you and I do about our code. Now we have 2 reusable components and 2 implementations that are perfectly reusable. This also gave us something called:</p><h3>Separation of concerns</h3><p>At the beginning of this post, I showed you the structure that I like to use for my projects. I think it is understandable and cleaner than many things out there, and a big part of that is thanks to the <em>Separation of Concerns</em>, a principle that I always try to follow. You can summarize it as: <em>don’t take responsibility for someone else’s actions</em>. It’s that easy. The <em>button </em>shouldn’t have the logic of the <em>input</em>, obviously, and the <em>Grid </em>shouldn’t be in charge of rendering your images, but instead rendering any children.</p><p>It’s that easy, really, and for some reason, sometimes I find myself arguing about it with some random co-worker (this happened to me last week).</p><h3>Wrapping up</h3><p>I’m finishing this post, and I feel like there’s something off with it, but I’m not sure what it is. I have the feeling that I’ve tried to cover so many aspects that I couldn’t go much deeper on any of them. So if you are interested in me talking more in-depth about some of these aspects, let me know.</p><h4>Before you go</h4><p>I’m thinking of posting on [X](<a href="https://x.com/Juan31323">https://x.com/Juan31323</a>). Would you follow me? Thank you in advance, and if you really enjoyed the post, would you help me pay my rent?</p><p>[ — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — ] 0% of $400</p><p><a href="https://www.buymeacoffee.com/juanemilio">HELP TO PAY MY RENT</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a31f50cafae5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>