<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Emmanuel Os</title>
    <description>The latest articles on DEV Community by Emmanuel Os (@eworld).</description>
    <link>https://dev.to/eworld</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F475448%2Fed63c712-d5a7-4325-b765-c34e9a7a67bf.jpg</url>
      <title>DEV Community: Emmanuel Os</title>
      <link>https://dev.to/eworld</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eworld"/>
    <language>en</language>
    <item>
      <title>Think You’re Doing It Right as a Software Engineer?</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Sun, 13 Oct 2024 20:08:15 +0000</pubDate>
      <link>https://dev.to/eworld/think-youre-doing-it-right-as-a-software-engineer-139o</link>
      <guid>https://dev.to/eworld/think-youre-doing-it-right-as-a-software-engineer-139o</guid>
      <description>&lt;h3&gt;
  
  
  Article Overview:
&lt;/h3&gt;

&lt;p&gt;2024 is shaping up to be a transformative year for software engineering, with new trends, frameworks, and methodologies challenging developers to rethink what they know. This article will delve into the state of modern software engineering, covering the essential technical skills, overlooked practices, and potential blind spots in three key areas: &lt;strong&gt;Web Development&lt;/strong&gt;, &lt;strong&gt;Backend Development&lt;/strong&gt;, and &lt;strong&gt;Mobile Development&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We’ll dissect each field, explore the latest practices, and identify where software engineers often go astray, focusing on the real issues:&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;The Comfort Zone of Complacency&lt;/strong&gt;&lt;br&gt;
Imagine a scenario: A senior frontend engineer, Joe, confidently codes a complex React app. He’s been in the industry for a decade and thinks his skills are up-to-date because he follows popular trends. However, his application is suffering from sluggish performance and his team is always firefighting bugs during deployments. Joe wonders: &lt;em&gt;What am I missing?&lt;/em&gt; The issue isn’t the code alone—it’s the mindset of being too comfortable and not questioning his approach as the technology landscape evolves.&lt;/p&gt;

&lt;p&gt;This article explores the traps engineers like Joe fall into and the technical nuances that separate good from great developers in 2024.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;1. Web Development in 2024: Beyond the Frontend Framework Wars&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Misuse of Modern Frameworks&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: Imagine a developer using React.js for a small static website. React’s initial render times are slower compared to static site generators like Next.js or Astro. The developer may argue, “I know React, so I’ll use React,” but this decision impacts performance and SEO negatively. This misuse of frameworks is a common issue.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: For a content-heavy website, use static site generators like Gatsby or Astro, which can optimize for performance and build static pages that are faster to load.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;SSR vs. CSR: Understanding the Trade-offs&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A high-traffic e-commerce site relies heavily on Client-Side Rendering (CSR) and uses React hooks for rendering products. During peak sales, their server experiences high CPU usage, and the pages take too long to load, resulting in a drop in conversion rates.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Switch to Server-Side Rendering (SSR) using frameworks like Next.js to reduce server load and ensure faster initial load times, leading to better user experiences.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Design Systems and Accessibility&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A popular SaaS application, designed beautifully, struggles to accommodate visually impaired users. The team realized too late that they never accounted for screen reader compatibility or keyboard navigation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Implement a design system that prioritizes accessibility. Use tools like Storybook to test component accessibility, ensuring color contrast ratios and ARIA attributes are set correctly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Common Pitfalls: Overusing Libraries or Ignoring New Tools&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A team uses a heavy date-handling library like Moment.js across the app. In 2024, they realize that smaller, modern libraries like date-fns could achieve the same functionality with less performance overhead.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Regularly audit your libraries and adopt leaner alternatives like date-fns or day.js. Staying updated with tools like BundlePhobia helps identify the cost of each dependency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2. Backend Development in 2024: Performance, Scaling, and Cloud-Native Architectures&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Microservices Gone Wrong&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A startup, in an attempt to follow the "microservices hype," splits their application into 20 services. Each service communicates with another via HTTP calls, leading to an overly complex network. During scaling, the application becomes almost impossible to manage, and latency issues creep up, delaying feature releases.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Apply a "right-size" approach. Start small, using a monolithic or modular monolith design, and split services only when necessary. Tools like Dapr or service meshes like Istio can help manage service communication efficiently.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Event-Driven Architectures Misuse&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A logistics company adopts Kafka to build an event-driven architecture. Instead of simplifying processes, they now face a chaotic data flow and debugging has become a nightmare because no one has a clear overview of how events propagate through the system.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Use event-driven architectures only when a clear benefit, such as real-time analytics or complex event handling, outweighs the added complexity. Focus on building observability using tools like OpenTelemetry for tracing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Kubernetes Overkill&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A small business with only a few services tries to migrate to Kubernetes, thinking it’s the industry standard. The overhead of managing Kubernetes clusters outweighs its benefits. The team spends more time fighting with Kubernetes configurations than developing new features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Use simpler container orchestration solutions like Docker Compose for small-scale applications. Adopt Kubernetes only when scaling and high availability are a must.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Security and Compliance: Adapting to Regulations&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A fintech startup fails a security audit because they didn’t account for new European regulations like PSD2. This mistake costs them a significant partnership.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Proactively build security into your pipeline using automated compliance tools like Open Policy Agent (OPA) and regularly update systems based on regulatory changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Database Decisions: Picking the Right Storage&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A company chooses a NoSQL database like MongoDB for a financial application, only to discover that complex transactions are a nightmare to implement. They end up rewriting significant portions of their backend.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Understand your data needs. For complex relational data, consider using PostgreSQL or a NewSQL database like CockroachDB. For flexible schema and document storage, MongoDB or FaunaDB might be a better fit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;3. Mobile Development in 2024: Moving Beyond the Basics&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;State Management Overuse&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A React Native app uses Redux for every component state, leading to convoluted, unmaintainable code. The app suffers from slow state updates and the developer spends more time refactoring than building features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Use simpler solutions like the Context API or Zustand for local state. Reserve Redux for managing global app states that need cross-component sharing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Cross-Platform Confusion&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A team starts with React Native but switches to Flutter mid-project because of performance concerns. They spend months rewriting code, only to realize that the performance bottlenecks were due to poor state management, not the framework.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Pick a framework based on your team’s strengths and project requirements. Tools like Expo for React Native simplify development, while Flutter excels in scenarios where UI consistency is paramount.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Ignoring Device Capabilities&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: An app that performs well on high-end devices fails on mid-range Android phones due to poor memory management and overuse of animations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Test your app on a variety of devices, focusing on optimizing memory usage and performance. Tools like Android Profiler and Xcode Instruments can identify bottlenecks early.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;4. Trends and Technologies to Watch: What’s Rising and What’s Fading?&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;AI-Enhanced Development Tools&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A team using GitHub Copilot reduces development time by 20% by automating repetitive coding tasks. However, they also realize that relying too heavily on it introduces subtle bugs due to over-reliance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Use AI as an assistant, not a replacement. Always review and refactor code generated by AI tools to ensure quality.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Edge Computing&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Real-life Example: A SaaS provider uses Cloudflare Workers to serve dynamic content closer to users, reducing latency by 50%. This move significantly improves their user retention in regions with slower network speeds.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Adopt edge computing to reduce latency for global users. Explore platforms like Vercel, Cloudflare, or AWS Lambda@Edge for building performant edge applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Conclusion: "Do You Really Know What You’re Doing?"&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In a field as fast-paced as software engineering, thinking you’ve mastered a technology can be a dangerous mindset. Always be ready to question your approach, stay updated with industry shifts, and embrace the discomfort of constant learning. After all, what worked yesterday might be holding you back today.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Balancing Codes and Mental Wellbeing: A Guide for Software Engineers</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Mon, 11 Dec 2023 10:13:24 +0000</pubDate>
      <link>https://dev.to/eworld/balancing-codes-and-mental-wellbeing-a-guide-for-software-engineers-d4d</link>
      <guid>https://dev.to/eworld/balancing-codes-and-mental-wellbeing-a-guide-for-software-engineers-d4d</guid>
      <description>&lt;p&gt;In the fast-paced world of software development, where deadlines loom and challenges abound, it's easy to neglect one's mental well-being. While technical expertise is crucial, prioritising mental health is essential for a fulfilling and sustainable career. This article explores the unique challenges software engineers face and offers practical strategies to achieve a balanced and healthy life.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding Mental Wellbeing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mental wellbeing encompasses more than just the absence of mental health issues. It's a state of positive mental health, characterized by self-awareness, emotional regulation, and the ability to navigate daily life's challenges. For software engineers, a healthy mind translates to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Boosted Productivity: Mental clarity and focus lead to smarter, not harder work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enhanced Creativity: A well-rested mind is fertile ground for innovative solutions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improved Relationships: Strong mental health fosters better communication and collaboration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adaptability: The ability to roll with the punches is crucial in the ever-evolving tech landscape.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Longevity in Career: Avoiding burnout fuels a longer and happier professional journey.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Positive Role Model: You inspire others to prioritize personal well-being.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Balancing the Scales: Codes vs. Mental Wellbeing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Balancing codes and mental wellbeing means creating a sustainable work-life balance within the demanding context of software engineering. Just as your body needs a balanced diet, your mind needs both work and relaxation. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Recognising Overwork: Learn to identify when stress levels climb and take proactive steps to de-stress.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setting Boundaries: Establish clear limits between work and personal time to avoid work-life bleed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prioritising Self-Care: Regular exercise, healthy eating, and adequate sleep are non-negotiable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open Communication: Discuss workload expectations and challenges with managers and colleagues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rewarding Yourself: Celebrate accomplishments and milestones to maintain motivation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Embracing Flexibility: Adapt to changing demands and be open to new approaches.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Seeking Support: Don't hesitate to seek help from colleagues, friends, family, or a therapist.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenges to Mental Wellbeing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Software engineers face unique challenges that can negatively impact their mental health. These can be broadly categorised into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Work-related: Complex problems, tight deadlines, unrealistic expectations, and lack of control.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Personal: Imposter syndrome, perfectionism, social isolation, and work-life imbalance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Industry-specific: Competitive environment, lack of recognition, and rapid technological change.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Statistics on Mental Health&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;62% of software engineers experience anxiety or depression.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;69% face stress or burnout at work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The suicide rate among software engineers is significantly higher than the national average.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Signs You Need a Wellness Check&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Frequent anxiety or panic attacks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Social withdrawal and isolation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Difficulty concentrating and making decisions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Physical symptoms of stress.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Suicidal thoughts or attempts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Strategies for a Balanced Life&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By adopting healthy habits and prioritising well-being, software engineers can build a sustainable and fulfilling career. Here are some tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Set boundaries and stick to them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Practice effective time management.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prioritise self-care, including exercise, healthy eating, and sleep.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Communicate openly with your team and manager.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reward yourself for achievements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Embrace flexibility and adaptability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Seek support from your network or a professional therapist.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Balancing codes and mental well-being is an ongoing journey. By prioritising self-awareness, implementing healthy practices, and seeking support when needed, software engineers can achieve a fulfilling career and a happy life. Remember, you are not alone in this struggle. Many resources are available to help you along the way.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>mentalhealth</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>React's Unexpected Offspring: How the Web Gave Birth to React Native</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Sat, 09 Dec 2023 16:36:52 +0000</pubDate>
      <link>https://dev.to/eworld/reacts-unexpected-offspring-how-the-web-gave-birth-to-react-native-4dgn</link>
      <guid>https://dev.to/eworld/reacts-unexpected-offspring-how-the-web-gave-birth-to-react-native-4dgn</guid>
      <description>&lt;h5&gt;
  
  
  A Tale of Innovation and Unintended Consequences
&lt;/h5&gt;

&lt;p&gt;In the ever-evolving world of technology, unexpected twists and turns can lead to groundbreaking advancements. Such is the story of React Native, a revolutionary framework that emerged from the fertile ground of the web. Unlike its parent, React, which reigns supreme in the realm of web development, React Native unexpectedly ventured into the seemingly distant territory of mobile apps, defying expectations and rewriting the rules of the game.&lt;/p&gt;

&lt;p&gt;This captivating journey began with the phenomenal rise of React. Its declarative nature and component-based approach brought order and elegance to the chaotic world of web development. Engineers were captivated by its simplicity and efficiency, leading to its widespread adoption by companies like Facebook and Netflix.&lt;/p&gt;

&lt;p&gt;However, amidst this web-centric triumph, a hidden yearning for a mobile experience began to stir. Developers craved the power and flexibility of React on their smartphones and tablets. This yearning, initially dismissed as a mere pipe dream, planted the seeds for a daring experiment - to bridge the gap between web and mobile, to bring React's magic to the world of apps.&lt;/p&gt;

&lt;p&gt;Enter React Native, the unforeseen offspring of this ambition. It was a bold move, a daring attempt to transplant the DNA of web development onto the fertile soil of mobile platforms. And it worked. React Native seamlessly integrated with native components, allowing developers to write JavaScript code that could be rendered across iOS and Android platforms.&lt;/p&gt;

&lt;p&gt;This unexpected birth was met with both excitement and skepticism. Some saw it as a game-changer, a revolution in mobile app development. Others questioned its viability, highlighting the potential challenges of adapting a web framework to the demands of native platforms.&lt;/p&gt;

&lt;p&gt;But React Native defied the naysayers. Its intuitive API, combined with the familiar React syntax, made it a breeze for web developers to build mobile apps. The rapid iteration cycle, a hallmark of React, found its way onto mobile, allowing developers to experiment and innovate with newfound speed and efficiency.&lt;/p&gt;

&lt;p&gt;Today, React Native stands tall as a testament to the unpredictable nature of innovation. It has empowered developers to create a new generation of mobile apps, apps that are not only beautiful and engaging but also built on a foundation of speed and efficiency.&lt;/p&gt;

&lt;p&gt;As we look towards the future, the story of React Native serves as an inspiration. It reminds us that sometimes the most unexpected ideas can lead to the most groundbreaking advancements. It encourages us to embrace the unknown, to experiment and explore, for in the fertile ground of uncertainty, the seeds of revolutionary innovation may lie hidden, waiting to be discovered.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>reactnative</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Tech is not for me, I am a fraud: A Journey of Growth and Overcoming Imposter Syndrome</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Tue, 05 Dec 2023 19:11:12 +0000</pubDate>
      <link>https://dev.to/eworld/tech-is-not-for-me-i-am-a-fraud-a-journey-of-growth-and-overcoming-imposter-syndrome-jk9</link>
      <guid>https://dev.to/eworld/tech-is-not-for-me-i-am-a-fraud-a-journey-of-growth-and-overcoming-imposter-syndrome-jk9</guid>
      <description>&lt;p&gt;In 2019, I embarked on a journey into the world of tech, fueled by excitement and ambition. I devoured tutorials, mimicking code and building basic projects. Looking back, it was a charade, a performance of competence built on shaky foundations. I convinced myself I was good, even landing a job as a Frontend developer using Angular. But the truth soon came crashing down. I was lost, overwhelmed, and ultimately, a failure.&lt;/p&gt;

&lt;p&gt;The weight of my imposter syndrome crushed me. "Tech is not for me," I whispered, the words echoing in the hollow chamber of my self-doubt. Shame and fear became my companions, leading me to a period of stagnation and disillusionment.&lt;/p&gt;

&lt;p&gt;But amidst the darkness, a spark of hope flickered. In 2021, I decided to rebuild, not just my skills, but myself. I started from scratch, embracing the fundamentals with humility. I built small projects, honing my craft and rediscovering the joy of creation. I found solace in online communities and learning platforms, connecting with others who shared my struggles and triumphs.&lt;/p&gt;

&lt;p&gt;The path wasn't easy. There were countless setbacks, moments of frustration, and nights spent battling self-doubt. But with each challenge, I grew stronger, my resilience forged in the fires of adversity. I began taking on small freelance projects, applying my knowledge to real-world problems.&lt;/p&gt;

&lt;p&gt;In 2022, I enrolled in a software engineering school, surrounding myself with fellow aspiring developers and mentors who believed in me. This environment fostered my growth, pushing me beyond my comfort zone and helping me unlock my potential. My hard work and dedication paid off, leading to opportunities I never dreamed possible.&lt;/p&gt;

&lt;p&gt;Today, I stand as a Software Engineer at C80 Limited, a testament to the power of perseverance and self-belief. My journey has been a rollercoaster of emotions, a dance between hope and despair, success and failure. But through it all, I have learned that the most important battles are fought within, against the demons of self-doubt and fear.&lt;/p&gt;

&lt;p&gt;The tech industry is not for the faint of heart. It demands constant learning, adaptation, and a relentless pursuit of excellence. But for those who dare to dream and have the courage to face their fears, the rewards are immeasurable.&lt;/p&gt;

&lt;p&gt;My journey is far from over. I continue to explore new horizons, venturing into the realm of mobile development and embracing the challenge of learning a new backend language, GoLang. The future beckons, and I face it with open arms, ready to learn, grow, and contribute to the ever-evolving world of technology.&lt;/p&gt;

&lt;p&gt;To those struggling with similar doubts, I say this: you are not alone. Imposter syndrome is a common enemy, but it can be overcome. Embrace the challenges, learn from your mistakes, and never stop believing in yourself. Your journey may be different, but the destination – a fulfilling career and a life filled with purpose – is within your reach. So, take that first step, keep learning, keep growing, and never give up on your dream.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>gratitude</category>
      <category>javascript</category>
    </item>
    <item>
      <title>A Journey from JavaScript to Go: Exploring Data Types</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Fri, 24 Nov 2023 14:22:06 +0000</pubDate>
      <link>https://dev.to/eworld/a-journey-from-javascript-to-go-exploring-data-types-233</link>
      <guid>https://dev.to/eworld/a-journey-from-javascript-to-go-exploring-data-types-233</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;JavaScript developers stepping into the world of Go (Golang) often find themselves in a realm that values simplicity, efficiency, and strong static typing. While JavaScript is dynamically typed, Go's static typing offers a different approach to handling data. In this article, we'll explore how a JavaScript developer can seamlessly transition to Go by comparing and contrasting the data types in both languages.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Numeric Types:
&lt;/h4&gt;

&lt;p&gt;JavaScript's numeric types include the generic &lt;code&gt;number&lt;/code&gt; type, whereas Go provides a more granular approach.&lt;/p&gt;

&lt;p&gt;In JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;jsInteger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;jsFloat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;goInteger&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;42&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;goFloat&lt;/span&gt; &lt;span class="kt"&gt;float64&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;3.14&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Go, specifying the exact size of numeric types ensures predictability and memory efficiency.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. String Type:
&lt;/h4&gt;

&lt;p&gt;Strings are fundamental in both languages, but Go's approach is more explicit.&lt;/p&gt;

&lt;p&gt;In JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;jsString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;goString&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Hello, World!"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go's strict typing requires explicitly stating the variable type, promoting clarity in code.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Boolean Type:
&lt;/h4&gt;

&lt;p&gt;Booleans represent truth values, and here, the languages align closely.&lt;/p&gt;

&lt;p&gt;In JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;jsBoolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;goBoolean&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The simplicity of boolean handling remains consistent, emphasizing readability.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Derived Types:
&lt;/h4&gt;

&lt;p&gt;Both languages support arrays and slices, but Go's static arrays bring a fixed-size advantage.&lt;/p&gt;

&lt;p&gt;In JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;jsArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;jsSlice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;goArray&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;goSlice&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;6&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go's arrays have a fixed size, which aids in performance optimization, while slices offer dynamic sizing.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Structs and Objects:
&lt;/h4&gt;

&lt;p&gt;JavaScript objects and Go structs both group variables, but Go's structs are explicitly defined.&lt;/p&gt;

&lt;p&gt;In JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;jsObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;GoStruct&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;Age&lt;/span&gt;  &lt;span class="kt"&gt;int&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;goInstance&lt;/span&gt; &lt;span class="n"&gt;GoStruct&lt;/span&gt;
&lt;span class="n"&gt;goInstance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"John"&lt;/span&gt;
&lt;span class="n"&gt;goInstance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go's structs enforce a clear structure, promoting maintainability.&lt;/p&gt;

&lt;h4&gt;
  
  
  6. Interfaces:
&lt;/h4&gt;

&lt;p&gt;JavaScript is prototype-based, while Go embraces interfaces for defining method sets.&lt;/p&gt;

&lt;p&gt;In JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// JavaScript uses prototype-based inheritance&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;JSObject&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Method&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// Go uses interfaces to define method sets&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;GoInterface&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Method&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;GoType&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="n"&gt;GoType&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Method&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Method"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go's interface approach ensures explicit method declaration and implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;Transitioning from JavaScript to Go involves embracing a statically typed, explicitly defined world of data types. While the syntax may differ, the fundamental concepts align, making the journey smooth for developers. By understanding and applying these data type comparisons, JavaScript developers can harness the power and efficiency that Go offers, creating robust and scalable applications. The key lies in appreciating the strengths of each language and leveraging them effectively in code.&lt;/p&gt;

</description>
      <category>go</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>Comparing Currency Formatting in JavaScript and Go: A Case Study</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Fri, 24 Nov 2023 13:28:52 +0000</pubDate>
      <link>https://dev.to/eworld/comparing-currency-formatting-in-javascript-and-go-a-case-study-2j2a</link>
      <guid>https://dev.to/eworld/comparing-currency-formatting-in-javascript-and-go-a-case-study-2j2a</guid>
      <description>&lt;p&gt;In the world of web development, presenting financial information in a clear and standardized way is crucial for a positive user experience. Currency formatting is a common task, and different programming languages offer various approaches to achieve this. In this article, we'll compare the implementation of a currency formatting function in JavaScript and Go, using the same case study.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Case Study Function
&lt;/h2&gt;

&lt;p&gt;Let's consider a simple currency formatting function named &lt;code&gt;formatPrice&lt;/code&gt;. The function takes a numeric value and returns a formatted string representing the currency. We'll look at the JavaScript version implemented using TypeScript and its equivalent Go implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  JavaScript (TypeScript) Implementation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;formatPrice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;_amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NumberFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en-NG&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;currency&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NGN&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;formatPrice&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Go Implementation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"text/template"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;FormatPrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="kt"&gt;float64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;currencyTemplate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"₦{{printf &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;%.2f&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt; .}}"&lt;/span&gt;
  &lt;span class="n"&gt;tmpl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;currencyTemplate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
  &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tmpl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1500.0&lt;/span&gt;
  &lt;span class="n"&gt;formattedPrice&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;FormatPrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;formattedPrice&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c"&gt;// Output: ₦1,500.00&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Key Differences and Considerations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Language Syntax and Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;JavaScript (TypeScript):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses TypeScript, a superset of JavaScript with static typing.&lt;/li&gt;
&lt;li&gt;Utilizes the nullish coalescing operator (&lt;code&gt;??&lt;/code&gt;) for default value assignment.&lt;/li&gt;
&lt;li&gt;Leverages the Internationalization API for number formatting.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Go:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A statically-typed language with a different syntax compared to JavaScript.&lt;/li&gt;
&lt;li&gt;Provides a simpler default value assignment without the need for the nullish coalescing operator.&lt;/li&gt;
&lt;li&gt;Uses the &lt;code&gt;text/template&lt;/code&gt; package for string formatting.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Error Handling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;JavaScript (TypeScript):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error handling is implicit in the use of the Internationalization API.&lt;/li&gt;
&lt;li&gt;The function returns a string, and any errors in formatting are handled internally.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Go:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explicit error handling is required using the &lt;code&gt;err&lt;/code&gt; variable.&lt;/li&gt;
&lt;li&gt;In the provided example, errors are handled by panicking, but in production code, a more robust error-handling strategy should be implemented.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Ecosystem and Use Cases
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;JavaScript (TypeScript):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Widely used for web development, especially on the client side.&lt;/li&gt;
&lt;li&gt;Extensive ecosystem with various libraries and frameworks.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Go:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frequently used for backend development and system-level programming.&lt;/li&gt;
&lt;li&gt;Known for its simplicity, performance, and concurrency support.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Use of Libraries
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;JavaScript (TypeScript):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Utilizes built-in features like the Internationalization API for number formatting.&lt;/li&gt;
&lt;li&gt;TypeScript brings static typing to the JavaScript ecosystem.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Go:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses the &lt;code&gt;text/template&lt;/code&gt; package from the standard library for string formatting.&lt;/li&gt;
&lt;li&gt;Simplicity is emphasized in the standard library, with a focus on minimalism.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Both JavaScript (TypeScript) and Go provide effective solutions for currency formatting, but they have different strengths and use cases. JavaScript, with its extensive ecosystem and focus on web development, incorporates features like the Internationalization API for this task. On the other hand, Go, with its simplicity and efficiency, uses the standard library's &lt;code&gt;text/template&lt;/code&gt; package for a straightforward and effective approach.&lt;/p&gt;

&lt;p&gt;The choice between these languages depends on the specific requirements of your project, the development environment, and your team's expertise. Whether you're building a dynamic web application or a robust backend service, understanding the strengths and characteristics of each language will help you make an informed decision.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>go</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Creating an NPM Package: From Company Utility to Public Module with 555 Weekly Downloads</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Tue, 01 Aug 2023 15:56:43 +0000</pubDate>
      <link>https://dev.to/eworld/creating-an-npm-package-from-company-utility-to-public-module-with-555-weekly-downloads-1ohh</link>
      <guid>https://dev.to/eworld/creating-an-npm-package-from-company-utility-to-public-module-with-555-weekly-downloads-1ohh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the fast-paced world of software development, converting a utility that was initially used internally in a company project into a public &lt;a href="https://www.npmjs.com/package/formatnumber-to-naira"&gt;NPM package&lt;/a&gt; can be a strategic decision. By doing so, not only can you streamline the codebase of your projects, but you also contribute to the open-source community while gaining visibility and traction for your own company. In this article, we will walk through the step-by-step process of converting a "formatPrice" utility used in our fintech app called re:current into an NPM package, resulting in an impressive 555 weekly downloads.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Understanding the Utility
&lt;/h2&gt;

&lt;p&gt;Our fintech app, re:current, focused on real estate, requires the ability to convert numerical amounts to Nigerian Naira (₦). Initially, we had a simple function called &lt;code&gt;formatPrice&lt;/code&gt;, embedded within our codebase. The function would take a numerical input and return the corresponding value in Nigerian Naira, using the correct currency format.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;formatPrice&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;formatnumber-to-naira&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1234567.89&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;formattedPrice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;formatPrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;formattedPrice&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: "₦1,234,567.89"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Code Isolation and Unit Tests
&lt;/h2&gt;

&lt;p&gt;Before we convert the utility into an NPM package, it is essential to isolate the utility function from the app's codebase and write comprehensive unit tests to ensure its correctness and robustness. The isolation step will help prevent any unintended dependencies on other parts of the app and ensure the utility remains self-contained.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Initializing NPM Package
&lt;/h2&gt;

&lt;p&gt;Now, let's get started with creating our NPM package. First, we need to initialize the package with the npm init command. This will generate a package.json file that stores metadata about our package, including its name, version, author, and dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the prompts and fill in the required information to create the package.json file.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Structuring the Package
&lt;/h2&gt;

&lt;p&gt;Next, we need to structure our NPM package appropriately. A typical structure includes a "src" folder for the source code and a "test" folder for the unit tests. Additionally, we'll need to create an index.js file in the root of the package that will serve as the entry point for our module.&lt;/p&gt;

&lt;p&gt;The directory structure should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- package.json
- /src
  - formatPrice.ts
  - index.ts
- /test
  - formatPrice.test.ts
- tsconfig.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Implementing the Package Logic
&lt;/h2&gt;

&lt;p&gt;Move the isolated formatPrice function into the src/formatPrice.js file. Update any references and dependencies within the function to make it self-sufficient. Ensure the function remains compatible with various input scenarios and handles edge cases effectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Writing Comprehensive Unit Tests
&lt;/h2&gt;

&lt;p&gt;In the test/formatPrice.test.js file, write comprehensive unit tests using a testing framework such as Jest. These tests should cover various input cases and verify that the function produces the correct output for each scenario. Proper testing is crucial to ensure the utility's reliability and maintainability in the long run.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Exporting the Function
&lt;/h2&gt;

&lt;p&gt;In the index.js file, export the formatPrice function from the src/formatPrice.js module using CommonJS or ES6 module syntax. This will make the function accessible when the package is installed in other projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Publishing to NPM
&lt;/h2&gt;

&lt;p&gt;Once the package has been implemented and tested thoroughly, it's time to publish it to the NPM registry. Use the following command to publish the package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: Before publishing, ensure that you have an NPM account and are logged in using npm login.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Updating and Maintaining the Package
&lt;/h2&gt;

&lt;p&gt;After publishing the package, it becomes available for public use. Users from all around the world can now install and incorporate it into their projects using npm install. It's essential to monitor the package for issues and updates, respond to user feedback, and address any bug reports promptly to maintain a healthy package ecosystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we discussed the process of converting an internal utility used in our fintech app re:current into a public NPM package. By releasing our "formatPrice" utility as an NPM package, we not only streamlined our app's codebase but also contributed to the open-source community. We hope this technical and detailed guide inspires other developers to share their useful utilities with the world, enabling innovation and collaboration in the development community.&lt;/p&gt;

&lt;p&gt;Do well to give us a star on our GitHub repository and check the NPM package using the links below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/josephe44/formatnumber-to-naira"&gt;GitHub Repository&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.npmjs.com/package/formatnumber-to-naira"&gt;NPM Package&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Building a Github Portfolio</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Tue, 10 Jan 2023 19:48:37 +0000</pubDate>
      <link>https://dev.to/eworld/building-a-github-portfolio-53l5</link>
      <guid>https://dev.to/eworld/building-a-github-portfolio-53l5</guid>
      <description>&lt;p&gt;Building a GitHub portfolio using ReactJS is a great way to showcase your skills as a developer and stand out. In this article, we will walk through the steps of building a GitHub portfolio using React.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a GitHub account&lt;br&gt;
The first step in building a GitHub portfolio is to create a GitHub account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new repository&lt;br&gt;
Once you have a GitHub account, you can create a new repository to store your portfolio. A repository is a place where you can store your code and collaborate with others on a project. To create a new repository, go to your GitHub profile and click the "New" button. Give your repository a name and description, and choose whether it will be public or private.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set up the project&lt;br&gt;
Once you have created your repository, you will need to set up the project. To do this, you will need to initialize the project with Node.js and install the necessary dependencies. You can do this by running the following commands in your terminal:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app github-app
cd github-app
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new React project in a folder called "github-app", and install the necessary dependencies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wMDsxyMK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e95sqyb6g8n4zs0yy9cm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wMDsxyMK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e95sqyb6g8n4zs0yy9cm.png" alt="folder structure image" width="191" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we need to install some more dependencies.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install react-router-dom
npm install react-icons
npm install react-error-boundary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need to use the react-router-dom to create routes in the react app, so we can switch from one page to another, using the react-router-dom link. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we will open the &lt;code&gt;scr&lt;/code&gt; folder and create a &lt;code&gt;folder&lt;/code&gt; called &lt;strong&gt;pages&lt;/strong&gt; inside the &lt;code&gt;src&lt;/code&gt;. That's where we will create the pages components we will use in our react app.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt; Home.jsx&lt;/li&gt;
&lt;li&gt; ErrorPage.jsx&lt;/li&gt;
&lt;li&gt; NotFound.jsx&lt;/li&gt;
&lt;li&gt; Repos.jsx&lt;/li&gt;
&lt;li&gt; Repo.jsx
These are the pages components we will use in building out our github portfolio app. &lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;inside &lt;code&gt;src&lt;/code&gt; we will create another folder called components. inside it we will create some little components for our app.&lt;/li&gt;
&lt;li&gt; Navbar.jsx&lt;/li&gt;
&lt;li&gt; Footer.jsx&lt;/li&gt;
&lt;li&gt; HomeRepoItem.jsx&lt;/li&gt;
&lt;li&gt; Pagination.jsx&lt;/li&gt;
&lt;li&gt; RepoItems.jsx&lt;/li&gt;
&lt;li&gt; SafeComponent.jsx&lt;/li&gt;
&lt;li&gt; Spinner.jsx&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UserProfile.jsx&lt;br&gt;
Phew!!, Lot of components created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;we will open the &lt;code&gt;App.js&lt;/code&gt; inside the src. That's where we are going to implement our react-router-dom, because is the parent component.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import "./App.css";

function App() {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;div className="App"&amp;gt;
        &amp;lt;Router&amp;gt;
          &amp;lt;Navbar /&amp;gt;
            &amp;lt;Routes&amp;gt;
             &amp;lt;Route path="/" element={&amp;lt;Home /&amp;gt;} /&amp;gt;
             &amp;lt;Route path="/repo-list/*" element={&amp;lt;Repos /&amp;gt;} /&amp;gt;
             &amp;lt;Route path="/error-boundary-page" element={&amp;lt;ErrorPage /&amp;gt;} /&amp;gt;
             &amp;lt;Route path="/not-found" element={&amp;lt;NotFound /&amp;gt;} /&amp;gt;
             &amp;lt;Route path="*" element={&amp;lt;NotFound /&amp;gt;} /&amp;gt;
            &amp;lt;/Routes&amp;gt;
         &amp;lt;/Router&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;Footer /&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The css file for this project is inside the &lt;a href="https://github.com/josephe44/altschool-2nd-semester-exam/blob/master/src/index.css"&gt;index.css&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside our Navbar.js we will write these codes to create a navbar we will use in our app.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useState } from "react";
import { NavLink, useLocation } from "react-router-dom";
import { FaBug, FaUser, FaAtom, FaHome } from "react-icons/fa";

function Navbar() {
  const [navOpen, setNavOpen] = useState(false);

  const location = useLocation();
  const handleNavOpen = () =&amp;gt; {
    setNavOpen((prev) =&amp;gt; !prev);
  };

  return (
    &amp;lt;nav className={navOpen ? "nav open" : "nav close"}&amp;gt;
      &amp;lt;header onClick={handleNavOpen}&amp;gt;
        &amp;lt;FaAtom /&amp;gt;
      &amp;lt;/header&amp;gt;
      &amp;lt;ul&amp;gt;
        &amp;lt;li className={location.pathname === "/" ? "link-hover" : "none"}&amp;gt;
          &amp;lt;NavLink to="/"&amp;gt;
            &amp;lt;span className="icon"&amp;gt;
              &amp;lt;FaHome /&amp;gt;
            &amp;lt;/span&amp;gt;
            &amp;lt;span className="path"&amp;gt;User&amp;lt;/span&amp;gt;
          &amp;lt;/NavLink&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li
          className={location.pathname === "/repo-list" ? "link-hover" : "none"}
        &amp;gt;
          &amp;lt;NavLink to="/repo-list"&amp;gt;
            &amp;lt;span className="icon"&amp;gt;
              &amp;lt;FaUser /&amp;gt;
            &amp;lt;/span&amp;gt;
            &amp;lt;span className="path"&amp;gt;Repos&amp;lt;/span&amp;gt;
          &amp;lt;/NavLink&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li
          className={
            location.pathname === "/error-boundary-page" ? "link-hover" : "none"
          }
        &amp;gt;
          &amp;lt;NavLink to="/error-boundary-page"&amp;gt;
            &amp;lt;span className="icon"&amp;gt;
              &amp;lt;FaBug /&amp;gt;
            &amp;lt;/span&amp;gt;
            &amp;lt;span className="path"&amp;gt;Error&amp;lt;/span&amp;gt;
          &amp;lt;/NavLink&amp;gt;
        &amp;lt;/li&amp;gt;
      &amp;lt;/ul&amp;gt;
    &amp;lt;/nav&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Inside our Footer.jsx we will write these codes to create a footer we will use in our app
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";

function Footer() {
  return (
    &amp;lt;footer&amp;gt;
      &amp;lt;div className="footer-container"&amp;gt;
        &amp;lt;p&amp;gt;© 2022 by "Put your name or anything"&amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/footer&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Inside our Spinner.jsx we will write these codes to create a spinner we will use in our app
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { FaSpinner } from "react-icons/fa";

function Spinner() {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;div className="spinner-container"&amp;gt;
        &amp;lt;FaSpinner className="spinner" /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;we will create a &lt;code&gt;context folder&lt;/code&gt; inside the &lt;code&gt;src folder&lt;/code&gt;. we will use react context because it will be an easy way to manage state globally. It can be used together with the useState Hook to share state between deeply nested components more easily than with useState alone.&lt;/li&gt;
&lt;li&gt;inside &lt;code&gt;context folder&lt;/code&gt; we will these files.&lt;/li&gt;
&lt;li&gt; UserContext.js&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RepoContext.js&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside our UserContext.js we will write these codes to handle our github user.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createContext, useState, useEffect } from "react";

const UserContext = createContext();

export const UserProvider = ({ children }) =&amp;gt; {
  const [user, setUser] = useState({});
  const [loading, setLoading] = useState(true);

  const url = process.env.REACT_APP_GITHUB_URL;
  const token = process.env.REACT_APP_GITHUB_TOKEN;

  useEffect(() =&amp;gt; {
    fetchUser();
  }, []);

  // fetching the user
  const fetchUser = async () =&amp;gt; {
    const response = await fetch(`${url}/users/josephe44`, {
      headers: {
        Authorization: `token ${token}`,
      },
    });
    const data = await response.json();
    setUser(data);
    setLoading(false);
  };

  return (
    &amp;lt;UserContext.Provider value={{ user, loading }}&amp;gt;
      {children}
    &amp;lt;/UserContext.Provider&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Inside our RepoContext.js we will write these codes to handle our github repo.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createContext, useState, useEffect } from "react";

const RepoContext = createContext();

export const RepoProvider = ({ children }) =&amp;gt; {
  const [loading, setLoading] = useState(true);
  const [repos, setRepos] = useState([]);
  const [repo, setRepo] = useState({});
  const [currentPage, setCurrentPage] = useState(1);
  const [repoPerPage] = useState(9);

  const url = process.env.REACT_APP_GITHUB_URL;
  const token = process.env.REACT_APP_GITHUB_TOKEN;

  useEffect(() =&amp;gt; {
    fetchRepos();
  }, []);

  //   fetch all repos
  const fetchRepos = async () =&amp;gt; {
    const params = new URLSearchParams({
      sort: "created",
      per_page: 36,
    });
    const response = await fetch(`${url}/users/josephe44/repos?${params}`, {
      headers: {
        Authorization: `token ${token}`,
      },
    });
    const data = await response.json();
    setRepos(data);
    setLoading(false);
  };

  //   fetch a repo by the name
  const fetchRepo = async (repoName) =&amp;gt; {
    const response = await fetch(`${url}/repos/josephe44/${repoName}`, {
      headers: {
        Authorization: `token ${token}`,
      },
    });
    const data = await response.json();
    setRepo(data);
    setLoading(false);
  };

  // Pagination logic
  const indexOfLastNumber = currentPage * repoPerPage;
  const indexOfFirstNumber = indexOfLastNumber - repoPerPage;
  const currentRepo = repos.slice(indexOfFirstNumber, indexOfLastNumber);
  const numberOfPages = Math.ceil(repos.length / repoPerPage);

  return (
    &amp;lt;RepoContext.Provider
      value={{
        repo,
        repos,
        loading,
        currentRepo,
        numberOfPages,
        currentPage,
        setCurrentPage,
        fetchRepo,
      }}
    &amp;gt;
      {children}
    &amp;lt;/RepoContext.Provider&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;Now we have our logic been written inside the context, we can now use it inside any component. But before that we need to wrap the context with all the pages that was created inside the parent component &lt;code&gt;App.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import { Navbar, Footer } from "./components";
import { Home, ErrorPage, NotFound, Repos } from "./pages";
import { RepoProvider } from "./context/RepoContext";
import { UserProvider } from "./context/UserContext";
import "./App.css";

function App() {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;RepoProvider&amp;gt;
        &amp;lt;UserProvider&amp;gt;
          &amp;lt;div className="App"&amp;gt;
            &amp;lt;Router&amp;gt;
              &amp;lt;Navbar /&amp;gt;
              &amp;lt;Routes&amp;gt;
                &amp;lt;Route path="/" element={&amp;lt;Home /&amp;gt;} /&amp;gt;
                &amp;lt;Route path="/repo-list/*" element={&amp;lt;Repos /&amp;gt;} /&amp;gt;
                &amp;lt;Route path="/error-boundary-page" element={&amp;lt;ErrorPage /&amp;gt;} /&amp;gt;
                &amp;lt;Route path="/not-found" element={&amp;lt;NotFound /&amp;gt;} /&amp;gt;
                &amp;lt;Route path="*" element={&amp;lt;NotFound /&amp;gt;} /&amp;gt;
              &amp;lt;/Routes&amp;gt;
            &amp;lt;/Router&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;Footer /&amp;gt;
        &amp;lt;/UserProvider&amp;gt;
      &amp;lt;/RepoProvider&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;Now we will be building out all the pages we have listed above, starting from Home.jsx. &lt;br&gt;
Inside the Home.jsx we have two component to build out, which we will use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UserProfile.jsx
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useContext } from "react";
import { Link } from "react-router-dom";
import {
  FaFileAlt,
  FaMapMarkerAlt,
  FaPencilAlt,
  FaUsers,
  FaUserFriends,
  FaRegEnvelope,
} from "react-icons/fa";
import UserContext from "../context/users/UserContext";

function UserProfile() {
  const { user } = useContext(UserContext);
  return (
    &amp;lt;&amp;gt;
      &amp;lt;section className="user-container"&amp;gt;
        &amp;lt;div className="user"&amp;gt;
          &amp;lt;div className="img-card"&amp;gt;
            &amp;lt;img src={user.avatar_url} alt="profile-img" /&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div className="user-details"&amp;gt;
            &amp;lt;h2&amp;gt;{user.name}&amp;lt;/h2&amp;gt;
            &amp;lt;p className="username"&amp;gt;{user.login}&amp;lt;/p&amp;gt;
            &amp;lt;p className="user-bio"&amp;gt;{user.bio}&amp;lt;/p&amp;gt;
            &amp;lt;section className="social-container"&amp;gt;
              &amp;lt;div className="social-card"&amp;gt;
                &amp;lt;div&amp;gt;
                  &amp;lt;FaUsers /&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;p&amp;gt;{user.followers}&amp;lt;/p&amp;gt;
              &amp;lt;/div&amp;gt;

              &amp;lt;div className="social-card"&amp;gt;
                &amp;lt;div&amp;gt;
                  &amp;lt;FaFileAlt /&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;p&amp;gt;{user.public_repos}&amp;lt;/p&amp;gt;
              &amp;lt;/div&amp;gt;
              &amp;lt;div className="social-card"&amp;gt;
                &amp;lt;div&amp;gt;
                  &amp;lt;FaUserFriends /&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;p&amp;gt;{user.following}&amp;lt;/p&amp;gt;
              &amp;lt;/div&amp;gt;
              &amp;lt;div className="social-card"&amp;gt;
                &amp;lt;div&amp;gt;
                  &amp;lt;FaPencilAlt /&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;p&amp;gt;{user.public_gists}&amp;lt;/p&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/section&amp;gt;
            &amp;lt;div className="contact"&amp;gt;
              &amp;lt;div className="social-flex"&amp;gt;
                &amp;lt;div className="location"&amp;gt;
                  &amp;lt;p&amp;gt;
                    &amp;lt;FaMapMarkerAlt /&amp;gt;
                  &amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;
                    &amp;lt;span&amp;gt; {user.location}&amp;lt;/span&amp;gt;
                  &amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
              &amp;lt;div className="email"&amp;gt;
                &amp;lt;p&amp;gt;
                  &amp;lt;FaRegEnvelope /&amp;gt;
                &amp;lt;/p&amp;gt;
                &amp;lt;p&amp;gt;
                  &amp;lt;span&amp;gt;{user.email}&amp;lt;/span&amp;gt;
                &amp;lt;/p&amp;gt;
              &amp;lt;/div&amp;gt;

              &amp;lt;div className="group-btn"&amp;gt;
                &amp;lt;div className="portfolio-btn"&amp;gt;
                  &amp;lt;button&amp;gt;
                    &amp;lt;a target="_blank" rel="noreferrer" href={user.html_url}&amp;gt;
                      &amp;lt;span&amp;gt;View Profile&amp;lt;/span&amp;gt;
                    &amp;lt;/a&amp;gt;
                  &amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div className="portfolio-btn"&amp;gt;
                  &amp;lt;button&amp;gt;
                    &amp;lt;Link to="repo-list"&amp;gt;
                      &amp;lt;span&amp;gt;View More Repo&amp;lt;/span&amp;gt;
                    &amp;lt;/Link&amp;gt;
                  &amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/section&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

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

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;HomeRepoItem.jsx
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useContext } from "react";
import RepoContext from "../context/repos/RepoContext";

function HomeRepoItem() {
  const { currentRepo } = useContext(RepoContext);

  const repos = currentRepo.slice(0, 6);
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;div className="repo-container"&amp;gt;
        {repos.map((repo) =&amp;gt; (
          &amp;lt;div key={repo.id}&amp;gt;
            &amp;lt;div className="repo-card"&amp;gt;
              &amp;lt;div className="repo-flex"&amp;gt;
                &amp;lt;div className="repo-header"&amp;gt;
                  &amp;lt;h4&amp;gt;{repo.name}&amp;lt;/h4&amp;gt;
                  &amp;lt;div className="repo-avatar"&amp;gt;
                    &amp;lt;img src={repo.owner.avatar_url} alt="avatar" /&amp;gt;
                  &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;p className="desc"&amp;gt;{repo.description}&amp;lt;/p&amp;gt;

                &amp;lt;div className="repo-desc"&amp;gt;
                  &amp;lt;p&amp;gt;{repo.owner.login}&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;{repo.language ? repo.language : ""}&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        ))}
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;


&lt;p&gt;So inside the Home.jsx we will import it and use those components.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useContext } from "react";
import { UserProfile, Spinner, HomeRepoItem } from "../components";
import UserContext from "../context/users/UserContext";

function Home() {
  const { loading } = useContext(UserContext);

  if (loading) {
    return &amp;lt;Spinner /&amp;gt;;
  }

  return (
    &amp;lt;div className="home"&amp;gt;
      &amp;lt;UserProfile /&amp;gt;
      &amp;lt;HomeRepoItem /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;Now we will be build out the Repos page we listed above.&lt;br&gt;
Inside the Repos.jsx we have two component to build out, which we will use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RepoItems.jsx
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useContext } from "react";
import { Link } from "react-router-dom";
import RepoContext from "../context/repos/RepoContext";

function RepoItems() {
  const { currentRepo } = useContext(RepoContext);
  const repos = currentRepo;

  return (
    &amp;lt;div className="repo-bottom"&amp;gt;
      &amp;lt;div className="repo-container"&amp;gt;
        {repos.map((repo) =&amp;gt; (
          &amp;lt;div key={repo.id}&amp;gt;
            &amp;lt;Link to={`repo/${repo.name}`}&amp;gt;
              &amp;lt;div className="repo-card"&amp;gt;
                &amp;lt;div className="repo-flex"&amp;gt;
                  &amp;lt;div className="repo-header"&amp;gt;
                    &amp;lt;h4&amp;gt;{repo.name}&amp;lt;/h4&amp;gt;
                    &amp;lt;div className="repo-avatar"&amp;gt;
                      &amp;lt;img src={repo.owner.avatar_url} alt="avatar" /&amp;gt;
                    &amp;lt;/div&amp;gt;
                  &amp;lt;/div&amp;gt;
                  &amp;lt;p className="desc"&amp;gt;{repo.description}&amp;lt;/p&amp;gt;

                  &amp;lt;div className="repo-desc"&amp;gt;
                    &amp;lt;p&amp;gt;{repo.owner.login}&amp;lt;/p&amp;gt;
                    &amp;lt;p&amp;gt;{repo.language ? repo.language : ""}&amp;lt;/p&amp;gt;
                  &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/Link&amp;gt;
          &amp;lt;/div&amp;gt;
        ))}
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Pagination.jsx
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState, useEffect, useContext } from "react";
import { FaAngleDoubleLeft, FaAngleDoubleRight } from "react-icons/fa";
import RepoContext from "../context/repos/RepoContext";

function Pagination() {
  const { numberOfPages, currentPage, setCurrentPage } =
    useContext(RepoContext);
  const [disabledPrev, setDisabledPrev] = useState(true);
  const [disabledNext, setDisabledNext] = useState(true);

  const pageNumbers = [...Array(numberOfPages + 1).keys()].slice(1);

  const nextPage = () =&amp;gt; {
    if (currentPage !== numberOfPages) setCurrentPage(currentPage + 1);
  };
  const prevPage = () =&amp;gt; {
    if (currentPage !== 1) setCurrentPage(currentPage - 1);
  };

  useEffect(() =&amp;gt; {
    if (currentPage &amp;gt; 1) {
      setDisabledPrev(false);
    } else {
      setDisabledPrev(true);
    }

    if (currentPage === numberOfPages) {
      setDisabledNext(true);
    } else {
      setDisabledNext(false);
    }
  }, [currentPage, numberOfPages]);
  return (
    &amp;lt;&amp;gt;
      &amp;lt;section&amp;gt;
        &amp;lt;ul className="pagination"&amp;gt;
          &amp;lt;li&amp;gt;
            &amp;lt;button
              className={disabledPrev ? "disable-btn" : "page-link"}
              onClick={prevPage}
            &amp;gt;
              &amp;lt;FaAngleDoubleLeft /&amp;gt;
            &amp;lt;/button&amp;gt;
          &amp;lt;/li&amp;gt;
          {pageNumbers.map((pgNumber) =&amp;gt; (
            &amp;lt;li key={pgNumber}&amp;gt;
              &amp;lt;button
                onClick={() =&amp;gt; setCurrentPage(pgNumber)}
                className="page-link"
              &amp;gt;
                {pgNumber}
              &amp;lt;/button&amp;gt;
            &amp;lt;/li&amp;gt;
          ))}
          &amp;lt;li&amp;gt;
            &amp;lt;button
              className={disabledNext ? "disable-btn" : "page-link"}
              onClick={nextPage}
            &amp;gt;
              &amp;lt;FaAngleDoubleRight /&amp;gt;
            &amp;lt;/button&amp;gt;
          &amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
      &amp;lt;/section&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

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

&lt;/div&gt;


&lt;p&gt;So inside the Repos.jsx we will import it and use those components.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useContext } from "react";
import { useLocation, Routes, Route } from "react-router-dom";
import { RepoItems, Spinner, Pagination } from "../components";
import RepoContext from "../context/repos/RepoContext";
import Repo from "./Repo";

function Repos() {
  const { loading } = useContext(RepoContext);

  const location = useLocation();

  if (loading) {
    return &amp;lt;Spinner /&amp;gt;;
  }

  return (
    &amp;lt;&amp;gt;
      &amp;lt;div className="home"&amp;gt;
        {location.pathname === "/repo-list" ? (
          &amp;lt;&amp;gt;
            &amp;lt;RepoItems /&amp;gt;
            &amp;lt;Pagination /&amp;gt;
          &amp;lt;/&amp;gt;
        ) : (
          &amp;lt;Routes&amp;gt;
            &amp;lt;Route path="repo/:repoName" element={&amp;lt;Repo /&amp;gt;} /&amp;gt;
          &amp;lt;/Routes&amp;gt;
        )}
      &amp;lt;/div&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;Now we will be build out the Repo page we listed above.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repo.jsx
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useEffect, useContext } from "react";
import { Link, useParams } from "react-router-dom";
import { FaAngleDoubleLeft } from "react-icons/fa";
import { Spinner } from "../components";
import RepoContext from "../context/repos/RepoContext";

function Repo() {
  const { loading, repo, fetchRepo } = useContext(RepoContext);
  const { repoName } = useParams();

  useEffect(() =&amp;gt; {
    fetchRepo(repoName);
  }, [repoName]);

  if (loading) return &amp;lt;Spinner /&amp;gt;;

  return (
    &amp;lt;div className="eachRepo-container"&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;Link to="/repo-list"&amp;gt;
          &amp;lt;button className="back-btn"&amp;gt;
            &amp;lt;FaAngleDoubleLeft /&amp;gt;
            &amp;lt;span&amp;gt; Back&amp;lt;/span&amp;gt;
          &amp;lt;/button&amp;gt;
        &amp;lt;/Link&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div className="eachRepo-card"&amp;gt;
        &amp;lt;div className="eachRepo-item"&amp;gt;
          &amp;lt;div&amp;gt;
            &amp;lt;h3&amp;gt;{repo.name}&amp;lt;/h3&amp;gt;
            &amp;lt;p&amp;gt;{repo.description}&amp;lt;/p&amp;gt;
            &amp;lt;div className="eachRepo-visit"&amp;gt;
              &amp;lt;button className="visit-button"&amp;gt;
                &amp;lt;a target="_blank" rel="noreferrer" href={repo.html_url}&amp;gt;
                  view on github
                &amp;lt;/a&amp;gt;
              &amp;lt;/button&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div className="banner-grid"&amp;gt;
            &amp;lt;p className="eachRepo-banner"&amp;gt;Fork: {repo.forks_count}&amp;lt;/p&amp;gt;
            &amp;lt;p className="eachRepo-banner"&amp;gt;
              Language: {repo.language ? repo.language : "none"}
            &amp;lt;/p&amp;gt;
            &amp;lt;p className="eachRepo-banner"&amp;gt;File Size: {repo.size}kb&amp;lt;/p&amp;gt;
            &amp;lt;p className="eachRepo-banner"&amp;gt;Visibility : {repo.visibility}&amp;lt;/p&amp;gt;
            &amp;lt;p className="eachRepo-banner"&amp;gt;Watchers : {repo.watchers}&amp;lt;/p&amp;gt;
            &amp;lt;p className="eachRepo-banner"&amp;gt;Open Issues : {repo.open_issues}&amp;lt;/p&amp;gt;
            &amp;lt;p className="eachRepo-banner"&amp;gt;
              Network Count : {repo?.network_count}
            &amp;lt;/p&amp;gt;
            {repo?.parent?.default_branch ? (
              &amp;lt;p className="eachRepo-banner"&amp;gt;
                Branch : {repo?.parent.default_branch}
              &amp;lt;/p&amp;gt;
            ) : null}

            {repo?.license?.name ? (
              &amp;lt;p className="eachRepo-banner"&amp;gt;License: {repo.license.name}&amp;lt;/p&amp;gt;
            ) : null}
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;Now we will be build out the NotFound page we listed above.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NotFound.jsx
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { Link } from "react-router-dom";
import { FaReply, FaRegTired } from "react-icons/fa";

function NotFound() {
  return (
    &amp;lt;div className="not-found"&amp;gt;
      &amp;lt;h1&amp;gt;404&amp;lt;/h1&amp;gt;
      &amp;lt;div className="not-found-icon"&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;FaRegTired /&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;p&amp;gt;Page Not Found&amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;button className="not-found-btn"&amp;gt;
        &amp;lt;Link to="/"&amp;gt;
          &amp;lt;div&amp;gt;
            &amp;lt;FaReply /&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;span&amp;gt;Go Back Home&amp;lt;/span&amp;gt;
        &amp;lt;/Link&amp;gt;
      &amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;Inside the ErrorPage.jsx we have one component to build out, which we will use. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SafeComponent
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function SafeComponent({ error }) {
  return (
    &amp;lt;div role="alert"&amp;gt;
      &amp;lt;p&amp;gt;Something went wrong:&amp;lt;/p&amp;gt;
      &amp;lt;pre style={{ color: "red" }}&amp;gt;{error.message}&amp;lt;/pre&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;Now we will be build out the ErrorPage page we listed above.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ErrorPage.jsx
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { ErrorBoundary } from "react-error-boundary";
import { SafeComponent } from "../components";

function ErrorPage() {
  return (
    &amp;lt;div className="error"&amp;gt;
      &amp;lt;h1&amp;gt;Implementation of ErrorBoundary&amp;lt;/h1&amp;gt;
      &amp;lt;ErrorBoundary FallbackComponent={SafeComponent}&amp;gt;
        &amp;lt;Error /&amp;gt;
      &amp;lt;/ErrorBoundary&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

function Error() {
  throw new Error("Error");
}

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Download Any YouTube Video With 5 Lines Of Code In Python</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Fri, 14 Jan 2022 15:54:13 +0000</pubDate>
      <link>https://dev.to/eworld/download-any-youtube-video-with-5-lines-code-in-python-4o2o</link>
      <guid>https://dev.to/eworld/download-any-youtube-video-with-5-lines-code-in-python-4o2o</guid>
      <description>&lt;p&gt;So am going to teach you how to download any YouTube video you like with 5 lines of python. seems impossible right? Don't worry it possible and achieving anything in tech is &lt;strong&gt;Possible&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let Start Coding
&lt;/h2&gt;

&lt;p&gt;There are few steps for us to take in achieving this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First open your code editor(VScode or Atom)&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create a file and name it anything you like &lt;code&gt;app.py&lt;/code&gt; with py as your extension.&lt;/li&gt;
&lt;li&gt;Then you need to install &lt;code&gt;pytube&lt;/code&gt; by running this code in your terminal.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install pytube
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Once the installation is done, then we need to import &lt;code&gt;YouTube&lt;/code&gt; from pytube&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from pytube import YouTube
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Then we need to create and call the path in which the video will be downloaded.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DOWNLOAD_FOLDER = "./"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;for me I use the current folder as my DOWNLOAD_FOLDER Path.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then we need to get the link of the video we want to download from YouTube Site.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;video_url = "https://www.youtube.com/watch?v=x7X9w_GIm1s"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;The video_url is a YouTube video &lt;a href="https://www.youtube.com/watch?v=x7X9w_GIm1s"&gt;Python in 100 Seconds&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then we need to create a youtube object and assign the video_url to it.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;video_obj = YouTube(video_url)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Then we need to create a media stream and know there are streaming technique adopted by YouTube.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stream = video_obj.streams.get_highest_resolution()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Then we need to use the download method to save the file&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stream.download(DOWNLOAD_FOLDER)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Your Code Should Be Like This
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from pytube import YouTube
DOWNLOAD_FOLDER = "./"
video_url = "https://www.youtube.com/watch?v=x7X9w_GIm1s"
video_obj = YouTube(video_url)
stream = video_obj.streams.get_highest_resolution()
stream.download(DOWNLOAD_FOLDER)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then one more thing, you could add a print statement to know when is done, by writing this one line of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Download Complete")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then click the &lt;code&gt;Run button&lt;/code&gt; on your &lt;strong&gt;code editor&lt;/strong&gt; and watch how your video get downloaded into your folder. &lt;strong&gt;Hurray you made it!!!&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Want to read the pytube doc, here is the link &lt;a href="https://pytube.io/en/latest/user/install.html"&gt;pytube doc&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading. &lt;br&gt;
follow me on twitter &lt;br&gt;
&lt;a href="https://twitter.com/Eworld_Tech"&gt;@Eworld_Tech&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Scope in JavaScript(var, let, const)</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Fri, 17 Dec 2021 15:27:22 +0000</pubDate>
      <link>https://dev.to/eworld/scope-in-javascriptvar-let-const-i1</link>
      <guid>https://dev.to/eworld/scope-in-javascriptvar-let-const-i1</guid>
      <description>&lt;p&gt;Scope in JavaScript is divided into the Block Scope, Function Scope and the Global Scope.&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting with the Global Scope
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Global scope
var a = 1;
let b = 2
const c = 3
console.log(`Global Scope ${a} ${b} ${c}`)

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This is a global scope and everything is fine, if you console.log the value&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Function Scope
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Global scope
var a = 1
let b = 2
const c = 3

//Function scope
function num() {
  var a = 10
  let b = 22
  const c = 5
  console.log(`Function Scope ${a} ${b} ${c}`)
}
num()

console.log(`Global Scope ${a} ${b} ${c}`)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So inside the function scope we get our &lt;code&gt;10, 22, 5&lt;/code&gt; while in the global scope we still get our &lt;code&gt;1, 2, 3,&lt;/code&gt; because they are different variables in different scope.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Var&lt;/code&gt; is a &lt;strong&gt;Function scope&lt;/strong&gt; It means they are only available inside the function they’re created in, or if not created inside a function, they are ‘globally scoped..
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var a = 1;
let b = 2
const c = 3

for(var a = 0; a &amp;lt; 10; a++) {
  console.log(a)
}
console.log(`Global Scope ${a} ${b} ${c}`)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The value of &lt;code&gt;var a = 10&lt;/code&gt; in the global scope.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;var a&lt;/code&gt; in the loop actually changes the value &lt;code&gt;var a&lt;/code&gt; in the global scope which is not good, that's the reason &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; was created.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; &lt;code&gt;var&lt;/code&gt; is kind of wired, that's one of the thing that lot of people didn't like about JavaScript. it causes security risks and it can cause confusion if you have some variables in the global scope.&lt;/p&gt;

&lt;h2&gt;
  
  
  Block Scope
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Global scope
var a = 1
let b = 2
const c = 3

// Block Scope
if(true) {
  var a = 6
  let b = 7
  const c = 10
  console.log(`Block Scope ${a} ${b} ${c}`)
}
console.log(`Global Scope ${a} ${b} ${c}`)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What do you think the global scope &lt;code&gt;var a&lt;/code&gt; result will be? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The result will be &lt;code&gt;var a = 6&lt;/code&gt; because after declaring the &lt;code&gt;var a = 1&lt;/code&gt; on the global scope it was change in the block scope.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Notice the &lt;code&gt;let and const&lt;/code&gt; &lt;strong&gt;didn't change&lt;/strong&gt;, in the global scope they retain their values and also in the block scope.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Benefit of let &amp;amp; const&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They aren't scoped to the function, they are scoped to the block.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What is the block?&lt;/strong&gt; A block is a set of opening and closing curly brackets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Points to Take
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;var&lt;/code&gt; is function scope.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are block scope.&lt;/li&gt;
&lt;li&gt;Function scope is within the function.&lt;/li&gt;
&lt;li&gt;Block scope is within curly brackets.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Building a Countdown App</title>
      <dc:creator>Emmanuel Os</dc:creator>
      <pubDate>Sat, 17 Apr 2021 20:10:25 +0000</pubDate>
      <link>https://dev.to/eworld/building-a-countdown-app-46bl</link>
      <guid>https://dev.to/eworld/building-a-countdown-app-46bl</guid>
      <description>&lt;p&gt;Building the count app with JavaScript, but before that, I will highlight the steps we will be taking.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;write our html code&lt;/li&gt;
&lt;li&gt;write our css for styling &lt;/li&gt;
&lt;li&gt;write our JavaScript, to manipulate the data and give us a countdown App.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;HTML CODE&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  &amp;lt;h1&amp;gt;Countdown to 2022&amp;lt;/h1&amp;gt;
  &amp;lt;div class="countdown-container"&amp;gt;
    &amp;lt;div class="countdown-value days-c"&amp;gt;
      &amp;lt;p class="big-text" id="days"&amp;gt;0&amp;lt;/p&amp;gt;
      &amp;lt;span&amp;gt;days&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="countdown-value hour-c"&amp;gt;
      &amp;lt;p class="big-text" id="hour"&amp;gt;0&amp;lt;/p&amp;gt;
      &amp;lt;span&amp;gt;hours&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="countdown-value minute-c"&amp;gt;
      &amp;lt;p class="big-text" id="mins"&amp;gt;0&amp;lt;/p&amp;gt;
      &amp;lt;span&amp;gt;mins&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="countdown-value seconds-c"&amp;gt;
      &amp;lt;p class="big-text" id="seconds"&amp;gt;0&amp;lt;/p&amp;gt;
      &amp;lt;span&amp;gt;seconds&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;from the above code, you can see, how we have written our html code. Now we move to our &lt;strong&gt;css for styling&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS CODE&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* {
  box-sizing: border-box;
}

body {
  background-color: tomato;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  font-family: Georgia, 'Times New Roman', Times, serif;
  margin: 0;
  color: #f4f4f4;
}

h1 {
  font-weight: normal;
  font-size: 4rem;
  margin-top: 5rem;
  text-transform: uppercase;
  font-family: sans-serif;
}

.countdown-container {
  display: flex;
}

.big-text {
  font-weight: bold;
  font-size: 6rem;
  line-height: 1;
  margin: 0 2rem;
}

.countdown-value {
  text-align: center;
}
.countdown-value span {
  font-size: 1.3rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will move to JavaScript, so we manipulate the data in the html code and make it dynamic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript&lt;/strong&gt;&lt;br&gt;
we will get all the html element using there Id.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const daysEl = document.getElementById('days');
const hoursEl = document.getElementById('hour');
const minsEl = document.getElementById('mins');
const secondsEl = document.getElementById('seconds');

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

&lt;/div&gt;



&lt;p&gt;then we will choose the date we want to countdown too&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const countdown = "1 Jan 2022";

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

&lt;/div&gt;



&lt;p&gt;then write our function, where we will bring in our current date and the date will want to countdown too. Do some maths(remember JavaScript have numbers and math object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function countdownApp() {
  const countdownDate = new Date(countdown);
  const currentDate = new Date();

  const totalseconds = (countdownDate - currentDate) / 1000;

  const days = Math.floor(totalseconds / 3600 / 24);
  const hour = Math.floor(totalseconds / 3600) % 24;
  const mins = Math.floor(totalseconds / 60) %60;
  const seconds = Math.floor(totalseconds) % 60;

  daysEl.innerHTML = days;
  hoursEl.innerHTML = formatTime(hour);
  minsEl.innerHTML = formatTime(mins);
  secondsEl.innerHTML = formatTime(seconds);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we will format the time, so as to start the countdown accurate&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function formatTime(time) {
  return time &amp;lt; 10? `0${time}` : time;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then we will call the function to kick start and set our interval for the countdown&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;countdownApp();

setInterval(countdownApp, 1000);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Your code is suppose to look like this in the complete version&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const daysEl = document.getElementById('days');
const hoursEl = document.getElementById('hour');
const minsEl = document.getElementById('mins');
const secondsEl = document.getElementById('seconds');

const countdown = "1 Jan 2022";

function countdownApp() {
  const countdownDate = new Date(countdown);
  const currentDate = new Date();

  const totalseconds = (countdownDate - currentDate) / 1000;

  const days = Math.floor(totalseconds / 3600 / 24);
  const hour = Math.floor(totalseconds / 3600) % 24;
  const mins = Math.floor(totalseconds / 60) %60;
  const seconds = Math.floor(totalseconds) % 60;

  daysEl.innerHTML = days;
  hoursEl.innerHTML = formatTime(hour);
  minsEl.innerHTML = formatTime(mins);
  secondsEl.innerHTML = formatTime(seconds);
}
function formatTime(time) {
  return time &amp;lt; 10? `0${time}` : time;
}

countdownApp();

setInterval(countdownApp, 1000);

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

&lt;/div&gt;



&lt;p&gt;And our countdown App is up and running, counting down to Jan 2022.&lt;/p&gt;

&lt;p&gt;*Oh we need to make it responsive for mobile devices&lt;br&gt;
Adding more code to our CSS code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@media screen and (max-width: 600px) {
  body {
    overflow: hidden;
  }
  h1 {
    font-size: 1.5rem;
    font-weight: 800;
  }
  .countdown-container {
    display: flex;
    flex-direction: column;
  }
  .big-text {
    font-size: 4rem;
    font-weight: normal;
  }
  .countdown-value span {
    margin: 1rem;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now is responsive and running. &lt;br&gt;
Thank you&lt;/p&gt;

&lt;p&gt;I wish to bring more, as I journey. &lt;/p&gt;

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