<?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: Stanley</title>
    <description>The latest articles on DEV Community by Stanley (@stanon).</description>
    <link>https://dev.to/stanon</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%2F1142097%2Fd9fc42c5-c2b6-47a8-b716-e5a221576889.png</url>
      <title>DEV Community: Stanley</title>
      <link>https://dev.to/stanon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stanon"/>
    <language>en</language>
    <item>
      <title>NextJS Vs ReactJS</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Sat, 30 Dec 2023 07:39:41 +0000</pubDate>
      <link>https://dev.to/stanon/nextjs-vs-reactjs-3mnh</link>
      <guid>https://dev.to/stanon/nextjs-vs-reactjs-3mnh</guid>
      <description>&lt;p&gt;Dive into the JavaScript landscape with our comprehensive comparison of NextJs and ReactJs. Uncover these technologies' strengths, use cases, key differences, and performance. Choose the ideal tool for your web development projects.&lt;/p&gt;

&lt;p&gt;Whether you’re a seasoned developer or a newcomer, this guide decodes the nuances. Let’s make it easy for you to navigate the dynamic world of JavaScript frameworks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Web development is a dynamic realm. Your choice of a JavaScript framework can significantly impact the success of your projects.&lt;/p&gt;

&lt;p&gt;Developers strive for optimal performance, seamless user experience, and efficient project workflows. Understanding the nuances between these technologies becomes paramount.&lt;/p&gt;

&lt;h2&gt;
  
  
  prerequisites
&lt;/h2&gt;

&lt;p&gt;It is essential to ensure you have a fundamental understanding of the following prerequisites&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML and CSS proficiency&lt;/li&gt;
&lt;li&gt;Basic JavaScript knowledge&lt;/li&gt;
&lt;li&gt;ReactJs fundamentals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before we dive deep, one important thing to point out is that, when it comes to ReactJs and NextJS, it’s more of a partnership, not a competition. &lt;/p&gt;

&lt;p&gt;Think of ReactJS as a core tool for building user interfaces and NextJS steps in as the production-ready framework for React. In other words, NextJs is a React-based framework tailored for creating server-rendered apps (we dive deeper into server rendering later in the article). It's all about making ReactJs more powerful and versatile.  &lt;/p&gt;

&lt;h2&gt;
  
  
  ReactJS
&lt;/h2&gt;

&lt;p&gt;React is a JavaScript library introduced by Meta in 2011 as your go-to library for creating dynamic user interfaces. It is composed of user-friendly components that easily design interactive UIs. These components receive data and smoothly render the display. React is all about making UI designs simple and efficient. &lt;/p&gt;

&lt;p&gt;React has several features that make it one of the most popular front-end libraries. The features are as follows&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;Enhanced Performance&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;React utilizes a virtual Document Object Model (DOM) ensuring efficiency by updating only the modified components instead of re-rendering the entire DOM. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;Component Re-usability&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;React’s component-based architecture is a game changer. Once you create a component you can reuse it across your application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;Simplifying Debugging&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;React simplifies the debugging process by using unidirectional data flow from parent to child components. This makes it easier to trace issues&lt;/p&gt;

&lt;h2&gt;
  
  
  ReactJs is great for building the following.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic Search Engine Optimization (SEO) friendly websites&lt;/li&gt;
&lt;li&gt;Software as a service (Saas) apps&lt;/li&gt;
&lt;li&gt;Social media platforms&lt;/li&gt;
&lt;li&gt;Single page application&lt;/li&gt;
&lt;li&gt;Interactive dashboard visualization tools&lt;/li&gt;
&lt;li&gt;Video streaming platforms&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  NextJS
&lt;/h2&gt;

&lt;p&gt;NextJs is an open-source framework for React built by Vercel. What sets NextJs apart is the exceptional developer experience it offers for creating fast SEO-friendly apps. This means you can skip the struggles of dealing with extensive configurations and dive right into building your app. NextJS makes your life easier as a developer. &lt;/p&gt;

&lt;p&gt;Next has a lot of advantages, some of them are as follows&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;Easy Coding&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NextJs streamlines the coding process. It reduces code volume and enhances readability simplifying project management. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;Speed&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Apps built with NextJS are lightning-fast due to server-side rendering (SSR) and static generation. We explore more on Server-side rendering and Client-side rendering later in the article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;API Integration&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NextJs seamlessly connects to third-party Application Programming Interfaces (API) expanding project possibilities and enabling the creation of custom API routes. All this makes NextJs a great choice when building e-commerce stores.&lt;/p&gt;

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

&lt;p&gt;Here are several interesting differences between these two JavaScript tools. They will help you decide if you want to use them in combination or not. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Development Speed&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;NextJs Comes with built-in features that make developing advanced React apps easier. In NextJs 12, Vercel introduced its own compiler that speeds up the building process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Data fetching and Performance&lt;/em&gt;&lt;/strong&gt;*&lt;/p&gt;

&lt;p&gt;Performance is one of the major features that differentiate React from React combined with NextJs. NextJs can efficiently fetch data from the server by traversing the React tree allowing pages served by NextJs to load faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Rendering and SEO&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;NextJs is based on Server-side rendering while ReactJs is based on Client-side rendering. To understand, let’s expound on these two types of rendering.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server-side rendering(SSR) vs Client-side rendering(CSR)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;SSR&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Renders Pages on the server and sends fully rendered HTML to the client.&lt;/p&gt;

&lt;p&gt;Faster initial page load, better for SEO.&lt;/p&gt;

&lt;p&gt;Requires more server resources.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;CSR&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sends minimal HTML and relies on client-side JavaScript for rendering.&lt;/p&gt;

&lt;p&gt;Slower initial page load, SEO challenges.&lt;/p&gt;

&lt;p&gt;Enables dynamic, interactive user interfaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Routing&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;NextJs has a predefined file system for routing. This provides a structured approach. React offers various routing options through libraries like react-router.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React has limitations in configuration. It doesn’t provide robust support making it more complicated in changing settings. On the other hand, NextJs can be customized in a lot of ways.&lt;/p&gt;

&lt;h2&gt;
  
  
  Should you use React combined with NextJs?
&lt;/h2&gt;

&lt;p&gt;Try to think about nextJs as a turbo boost for React. NextJs provides enhanced structure and rendering features to React. Basically, NextJs acts as a powerful engine for React’s capabilities. It improves the already robust React functionality and rise it to a new level.&lt;/p&gt;

&lt;p&gt;The following are ways in which NextJs improves your React projects&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Routing&lt;/li&gt;
&lt;li&gt;Code Splitting&lt;/li&gt;
&lt;li&gt;Image Optimization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Decisions to use NextJs on your React apps will always depend on your requirements.&lt;/p&gt;

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

&lt;p&gt;As we wrap up our exploration of NextJS and ReactJs, it's clear that these frameworks offer unique strengths and applications. Decoding the nuances is crucial for developers navigating the dynamic JavaScript landscape.&lt;/p&gt;

&lt;p&gt;Ultimately, choosing between ReactJs and NextJS depends on your project needs. The dynamic partnership between them provides a powerful engine for developers, elevating ReactJs functionality based on specific requirements and goals.&lt;/p&gt;

</description>
      <category>react</category>
      <category>nextjs</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Mastering CSS Units: Pixels (px), rems, and ems Demystified</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Wed, 06 Sep 2023 05:13:07 +0000</pubDate>
      <link>https://dev.to/stanon/mastering-css-units-pixels-px-rems-and-ems-demystified-1k05</link>
      <guid>https://dev.to/stanon/mastering-css-units-pixels-px-rems-and-ems-demystified-1k05</guid>
      <description>&lt;p&gt;When it comes to crafting captivating web designs with CSS, selecting the right units for your measurements is absolutely crucial. CSS offers an array of units, but three of the most frequently employed are pixels (px), rems (rem), and ems (em). In this blog post, we'll delve into the differences between these units, shedding light on when and where to employ each one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pixels (px)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pixels (px) are the simplest unit of measurement in CSS. Each pixel corresponds to a single dot on the screen, making them absolute units. In other words, 1px will consistently represent one physical pixel on any user's device, irrespective of their screen's size or resolution. Pixels are typically used to define fixed sizes for elements like borders, margins, and padding.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pros of using px:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Exact control over element dimensions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Uniform appearance across various devices and screens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ideal for elements requiring fixed sizes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Cons of using px:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Non-responsive: Can pose problems on devices with different screen densities or when users zoom in or out.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Accessibility concerns: Fixed text sizes may not accommodate users with vision impairments who rely on text scaling.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Root ems (rem)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Root ems (rem) are relative units in CSS that rely on the font size of the root element, typically the  tag. Unlike pixels, rems are scalable and adapt seamlessly to changes in font size, making them the go-to choice for constructing responsive layouts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LBbWyY8X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zkr4s8sz06m5aanjhkmz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LBbWyY8X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zkr4s8sz06m5aanjhkmz.png" alt="Image description" width="591" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pros of using rem:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Scalable and responsive: Elements sized in rems adjust proportionally when the root font size changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simplifies responsive design: Altering the root font size affects all rem-based measurements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Accessibility-friendly: Allows users to adjust text size without breaking the layout.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Cons of using rem:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Limited control: Achieving precise element sizing, especially for non-text elements, can be challenging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inheritance: Child elements inherit the font size of their parent, potentially leading to unexpected results.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Element ems (em)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Element ems (em) are also relative units, but they are based on the font size of the parent element. This can result in a compounding effect where child elements inherit their parent's font size, making ems a valuable tool for creating nested, proportionate designs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hhR5TYFV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ef97p2wbdmgpm9dzp8hd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hhR5TYFV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ef97p2wbdmgpm9dzp8hd.png" alt="Image description" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pros of using em:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Nested proportionality: Child elements adapt to the font size of their parent, fostering consistent, nested designs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Responsive and scalable: Similar to rems, ems respond fluidly to changes in font size.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Cons of using em:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Complex calculations: Predicting sizes, especially in deeply nested elements, can be challenging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inheritance quirks in some cases.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To wrap things up, CSS provides a multitude of units to specify sizes and distances. The choice between pixels (px), rems, and ems depends on your design objectives. Pixels offer precise control but lack responsiveness, while rems and ems are relative units that adapt well to font size adjustments. Understanding when and how to utilize these CSS units will empower you to craft flexible and responsive web designs that shine across a wide range of devices and screen sizes.&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>Demystifying CSS Z-Index: What It Is and How It Works</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Tue, 05 Sep 2023 10:38:28 +0000</pubDate>
      <link>https://dev.to/stanon/demystifying-css-z-index-what-it-is-and-how-it-works-2jnf</link>
      <guid>https://dev.to/stanon/demystifying-css-z-index-what-it-is-and-how-it-works-2jnf</guid>
      <description>&lt;p&gt;If you've ever worked with web development and dabbled in creating multi-layered layouts or complex user interfaces, you've likely encountered the term "z-index." In the realm of CSS (Cascading Style Sheets), the z-index property plays a crucial role in determining the stacking order of elements on a web page. It may seem like a simple concept at first glance, but understanding it fully can be a game-changer when it comes to creating visually appealing and functional websites.&lt;/p&gt;

&lt;p&gt;In this blog post, we will delve into the world of CSS z-index, explaining what it is, how it works, and why it's an essential tool in a web developer's arsenal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is CSS Z-Index?&lt;/strong&gt;&lt;br&gt;
In simple terms, the z-index property in CSS controls the stacking order of elements in the z-axis of a web page. The z-axis is a perpendicular axis to the screen's surface, with the x-axis representing horizontal and the y-axis representing vertical positions. When you specify a z-index value for an element, you're essentially assigning it a "depth" on this z-axis. Elements with higher z-index values will appear in front of those with lower values.&lt;/p&gt;

&lt;p&gt;Consider a web page as a stack of sheets of paper. Each sheet represents an element on the page. The z-index property determines the order in which these sheets are stacked on top of each other. Elements with higher z-index values are placed above elements with lower values, just like placing one sheet of paper on top of another.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does Z-Index Work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To use the z-index property effectively, you need to understand how it interacts with different elements and their stacking contexts. Here are the key concepts to grasp:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Stacking Contexts&lt;br&gt;
Every HTML element creates a stacking context, which is a container that defines the stacking order for its child elements. Elements within the same stacking context are stacked relative to each other based on their z-index values. By default, elements within the same stacking context are rendered in the order they appear in the HTML source code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stacking Order Hierarchy&lt;br&gt;
When elements overlap in a web page, their stacking order is determined by the following factors:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The z-index property: Elements with higher z-index values are placed in front of elements with lower values within the same stacking context.&lt;/p&gt;

&lt;p&gt;The element's position: Positioned elements, such as those with position: relative, position: absolute, or position: fixed, are typically stacked in front of non-positioned elements within the same stacking context.&lt;/p&gt;

&lt;p&gt;The element's HTML source order: Elements that appear later in the HTML source code are stacked in front of elements that appear earlier in the same stacking context if their z-index values are the same.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stacking Context Hierarchy
Nested stacking contexts can affect the stacking order. If an element has a child element with a different stacking context, the child element is stacked in front of its parent element, regardless of z-index values.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Practical Applications of Z-Index&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Understanding how z-index works opens up various possibilities in web design and layout. Here are some common use cases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Layered Navigation Menus&lt;br&gt;
You can use z-index to create layered navigation menus, ensuring that drop-down menus appear on top of other page content when activated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modal Dialogs&lt;br&gt;
Modal dialogs, such as login forms or image galleries, can be displayed using z-index to overlay the rest of the page's content and draw the user's focus.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hover Effects&lt;br&gt;
Creating interactive hover effects, like tool-tips or pop-up information cards, becomes easy with z-index by ensuring these elements are positioned above other content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sliders and Carousels&lt;br&gt;
Implementing sliders or carousels with multiple images requires controlling the stacking order to display one image at a time while keeping the rest hidden behind.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Tips for Using Z-Index Effectively&lt;/strong&gt;&lt;br&gt;
To make the most of the z-index property, consider the following best practices:&lt;/p&gt;

&lt;p&gt;Avoid Excessive Use: Overusing z-index can lead to complex and hard-to-maintain code. Use it sparingly and only when necessary.&lt;/p&gt;

&lt;p&gt;Keep Elements in Their Own Stacking Context: When elements with higher z-index values should be contained within a specific section of your page, create a stacking context by applying CSS properties like position: relative or position: absolute to the parent element.&lt;/p&gt;

&lt;p&gt;Use a Logical Naming Convention: Give meaningful names to your z-index values (e.g., z-index: modal or z-index: navigation) to make your code more readable.&lt;/p&gt;

&lt;p&gt;Test Across Browsers: Some older browsers may handle z-index differently. Be sure to test your design on various browsers to ensure consistent behavior.&lt;/p&gt;

&lt;p&gt;As I conclude, the z-index property in CSS is a powerful tool for controlling the stacking order of elements in a web page's z-axis. By mastering this concept and its associated rules, you can create visually compelling and interactive web designs. Whether you're working on a simple navigation menu or a complex user interface, understanding z-index is essential for achieving the desired layout and user experience.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>CSS Display None Vs Visibility Hidden</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Mon, 04 Sep 2023 08:10:27 +0000</pubDate>
      <link>https://dev.to/stanon/css-display-none-vs-visibility-hidden-1e9f</link>
      <guid>https://dev.to/stanon/css-display-none-vs-visibility-hidden-1e9f</guid>
      <description>&lt;p&gt;When it comes to manipulating the visibility of elements on a web page using CSS, two commonly used properties are display and visibility. While both can be used to hide elements, they work in different ways and have distinct use cases. In this blog post, we will explore the differences between display: none and visibility: hidden, along with code samples to illustrate their behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;display: none&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The display: none property is a powerful tool for completely removing an element from the layout of the web page. When applied to an element, it not only makes the element invisible but also removes it from the document flow. This means that the element takes up no space, and surrounding elements act as if it doesn't exist.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Here's a simple example:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NUhwsxEX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n1uq54rofdj1s8yk9din.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NUhwsxEX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n1uq54rofdj1s8yk9din.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, the element with the class hidden-element is completely removed from the page's layout, and the other elements flow as if it's not there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;visibility: hidden&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the other hand, the visibility: hidden property hides an element while still occupying the same space it would if it were visible. This means that the hidden element is still part of the layout, and it affects the positioning of other elements around it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Here's an example:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bSLr9jYp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aykxh7d0sfi7kphpjvwo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bSLr9jYp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aykxh7d0sfi7kphpjvwo.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this case, the element with the class hidden-element is hidden, but it still occupies space in the layout, affecting the position of the visible elements around it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to Use Each&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that we understand the differences between display: none and visibility: hidden, let's discuss when to use each property.&lt;br&gt;
    • &lt;em&gt;Use display&lt;/em&gt;: none when you want to completely remove an element from the layout, and you don't want it to affect the space occupied by other elements. This is useful when you want to toggle the visibility of an element dynamically, such as in a drop-down menu.&lt;br&gt;
    • &lt;em&gt;Use visibility&lt;/em&gt;: hidden when you want to hide an element but still reserve its space in the layout. This is often used when you want to show and hide elements with animations or transitions, and you need the layout to remain stable.&lt;/p&gt;

&lt;p&gt;As I conclude, display: none and visibility: hidden are both valuable tools for controlling the visibility of elements in CSS, but they serve different purposes. Understanding their differences and knowing when to use each property is crucial for creating responsive and visually appealing web designs.&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>CSS DISPLAY PROPERTIES: BLOCK, INLINE &amp; INLINE-BLOCK</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Sun, 03 Sep 2023 20:25:27 +0000</pubDate>
      <link>https://dev.to/stanon/css-display-properties-block-inline-inline-block-4o7o</link>
      <guid>https://dev.to/stanon/css-display-properties-block-inline-inline-block-4o7o</guid>
      <description>&lt;p&gt;Folks! Some of the CSS display properties we mostly use are BLOCK, INLINE, and INLINE-BLOCK. Let us dive into these widely used display properties and have a clear understanding of their differences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Display: block&lt;/strong&gt;&lt;br&gt;
A block-level element has the following behaviors.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes full width by default.&lt;/li&gt;
&lt;li&gt;Each element starts with a new line.&lt;/li&gt;
&lt;li&gt;Width and height can be set
Examples of block-level elements include:-



&lt;h1&gt;
&lt;ul&gt;

&lt;/ul&gt;

&lt;/h1&gt;

&lt;p&gt;Display: inline&lt;br&gt;
An inline element has the following behaviors.&lt;br&gt;
-placed side by side. unlike block element which starts on a new line, inline elements can be displayed side by side.&lt;br&gt;
-Takes space as much as needed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Width and height can’t be set.
Examples of inline elements include:-
&lt;a&gt;
&lt;span&gt;
&lt;img&gt;
&lt;/span&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The following is a screenshot that shows the difference between the display Block and the display Inline property.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lwyF0GJo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iwjzoxsldcoky61qciyf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lwyF0GJo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iwjzoxsldcoky61qciyf.png" alt="Image description" width="800" height="199"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the left side of the screen, you can see the HTML file, and on the right is the web page. So as you can see without any CSS the three div elements are displayed each on a new line however the span tags are being displayed side by side.&lt;/p&gt;

&lt;p&gt;Now let’s add some styles to the elements so that you can see the difference better.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hVXDmJ61--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mdocco67oei57ukqjvaw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hVXDmJ61--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mdocco67oei57ukqjvaw.png" alt="Image description" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now as we can see, the border I gave to the div elements occupies the full width of the page because they have a display property of block, and the border of the span tags ends just after the text is finished.&lt;/p&gt;

&lt;p&gt;Now let’s add some width and height to the elements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iRmWkxrD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dnke08hphozl8kj92m2d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iRmWkxrD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dnke08hphozl8kj92m2d.png" alt="Image description" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we can see, the div elements take the width and height defined in the styles while the span elements do not get affected by the styles because as we said earlier, in inline elements we can not set the width and height properties.&lt;/p&gt;

&lt;p&gt;Would it be nice if we could just set the width and height property to an element and also place them side by side? luckily, there is a third way that allows us to do that and you guessed it right, it is called inline-block.&lt;/p&gt;

&lt;p&gt;Display: inline-block&lt;br&gt;
As we can understand from its name, it is a combination of block and inline features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Width and height can be set
-placed side by side.
In the below screenshot, note that the elements can now be set side by side and also have width and height defined in the styles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L5cMtcUe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o33nxyvyxkzxo31b8v5u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L5cMtcUe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o33nxyvyxkzxo31b8v5u.png" alt="Image description" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Understanding and applying these display properties will empower you to create well-structured, visually appealing web layouts. By making informed choices, you can enhance the readability and user experience of your web pages.&lt;/p&gt;


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

</description>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Why Use NodeJS Over Other Languages and Runtimes?</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Sat, 02 Sep 2023 08:57:34 +0000</pubDate>
      <link>https://dev.to/stanon/why-use-nodejs-over-other-languages-and-runtimes-48l6</link>
      <guid>https://dev.to/stanon/why-use-nodejs-over-other-languages-and-runtimes-48l6</guid>
      <description>&lt;p&gt;In the dynamic world of server-side development, choosing the right programming language can be a pivotal decision. As a newcomer to this realm, you might find yourself wondering why Node.js frequently takes the spotlight over other languages and frameworks like Go, Rust, C#, or Java when it comes to crafting powerful APIs. This inquiry goes beyond mere personal preference; it delves into a realm where innovation meets practicality and where the needs of your development team intersect with the demands of your project. In this exploration, we'll uncover the compelling reasons why Node.js has become a standout choice for building robust APIs, shedding light on its unique advantages that set it apart in the ever-evolving landscape of server-side development.&lt;/p&gt;

&lt;p&gt;I do personally enjoy using Node because it uses JavaScript. Maybe that's a shallow reason but honestly, when you are a full-stack engineer it's really easy to just focus on one language. Every language has a bunch of smaller nuisances where if you have to jump between languages just to implement a kind of a feature, it can make things really hard. There is a lot of code sharing that happens between the front end and the back end if you stick to one language.&lt;/p&gt;

&lt;p&gt;In this blog post, we'll explore why NodeJs is often considered a better runtime compared to others, highlighting some of its key advantages.&lt;/p&gt;

&lt;h1&gt;
  
  
  Speed and Efficiency:Node.js is built on the V8 JavaScript engine from Google, known for its lightning-fast performance. This makes Node.js exceptionally efficient in handling requests and delivering responses. Unlike traditional server-side languages that rely on threading or multi-processing, Node.js employs a single-threaded, event-driven architecture, which minimizes overhead and maximizes speed.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Non-Blocking I/O: One of Node.js's standout features is its non-blocking I/O model. This means that it can handle numerous concurrent connections without getting bogged down by blocking calls. This capability is crucial in scenarios where real-time updates and high-throughput applications are required, making Node.js an excellent choice for applications like chat applications, online gaming, and IoT devices.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Large and Active Community: Node.js boasts a vast and active developer community. With millions of developers worldwide, you can tap into a wealth of knowledge, resources, and open-source libraries. This active community ensures that Node.js stays up-to-date, secure, and continuously improved.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Cross-Platform Compatibility: Node.js is cross-platform by design. This means that you can write your server-side code once and run it on various platforms, including Windows, macOS, and Linux. This flexibility makes it easier to develop and deploy applications in different environments, reducing development time and costs.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  The ecosystem of Packages: Node.js has a rich ecosystem of packages available through the npm (Node Package Manager) registry. With over a million packages, you can find solutions for almost any development challenge. This extensive library of pre-built modules and libraries accelerates development, allowing you to focus on creating unique features rather than reinventing the wheel.
&lt;/h1&gt;

&lt;p&gt;As I conclude, Node.js shines in many aspects of modern web development, providing speed, scalability, and real-time capabilities that meet the demands of today's applications. However, it's vital to assess your project's specific needs and constraints carefully. Node.js excels in certain scenarios, but for CPU-intensive tasks, complex computations, legacy system integration, or when strong static typing is required, you may want to explore alternative languages or frameworks better suited to your objectives. Ultimately, the choice of language should align with your project's unique demands and your team's expertise, ensuring a successful and efficient development journey.&lt;/p&gt;

</description>
      <category>node</category>
      <category>backend</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>What Is NodeJS?</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Sat, 02 Sep 2023 08:49:27 +0000</pubDate>
      <link>https://dev.to/stanon/what-is-nodejs-59n0</link>
      <guid>https://dev.to/stanon/what-is-nodejs-59n0</guid>
      <description>&lt;p&gt;Even though there are plenty of good answers out there, the one that I like the most is this one, Node Js is an environment to run JavaScript outside the browser.&lt;br&gt;
NodeJs was created in 2009 and It is built on Chrome's JavaScript V8 engine.&lt;br&gt;
As you probably are aware, every browser has an engine, a tool that compiles our code down to machine code and Chrome uses one by the name of V8.&lt;br&gt;
In extremely simple terms, the creator of Node Ryan Dahl ripped out the V8 engine and built Node on top of it.&lt;br&gt;
Since the moment it was created, Node has evolved tremendously and while there are many things to like about Node, I particularly enjoy the large community around Node since that exceedingly saves time on feature development, as well as the fact that with the help of Node, it has never been easier to build full-stack apps since both front-end and back-end are essentially built in the same language, and you guessed it, that language is our beloved JavaScript.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>backend</category>
    </item>
    <item>
      <title>FIX "ReferenceError: __dirname is not defined in ES module scope" in NodeJs.</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Thu, 31 Aug 2023 07:10:16 +0000</pubDate>
      <link>https://dev.to/stanon/fix-referenceerror-dirname-is-not-defined-in-es-module-scope-in-nodejs-9lm</link>
      <guid>https://dev.to/stanon/fix-referenceerror-dirname-is-not-defined-in-es-module-scope-in-nodejs-9lm</guid>
      <description>&lt;p&gt;'__dirname' is used to get the directory name of the currently executing module's file. &lt;br&gt;
Let's first try to understand why this error is flagged. This error occurs because __dirname is not available as a global variable in ES6 (ECMAScript 2015) module scope. In ES6 modules, the global scope is encapsulated, and certain variables that were available in CommonJS modules (like __dirname and __filename) are not automatically available in ES6 modules. Remember that there are two types of module systems, CommonJS and ES6 module systems.&lt;br&gt;
To Fix this Error, we can use the following alternative method: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      import { dirname } from 'path';
      import { fileURLToPath } from 'url';

      const __filename =fileURLToPath(import.meta.url);
      const __dirname = dirname(__filename);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;By following this approach, you can access the equivalent of __dirname in ES6 modules without encountering the "ReferenceError".&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>backenddevelopment</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Sending Jwt's using cookies in NodeJs Explained</title>
      <dc:creator>Stanley</dc:creator>
      <pubDate>Sat, 19 Aug 2023 19:31:17 +0000</pubDate>
      <link>https://dev.to/stanon/-sending-jwts-using-cookies-in-nodejs-explained--aml</link>
      <guid>https://dev.to/stanon/-sending-jwts-using-cookies-in-nodejs-explained--aml</guid>
      <description>&lt;p&gt;Sending JWTs (Json web tokens) using cookies in Node.js is like giving a special pass to someone after they've logged into a website. This pass, the JWT, is like a digital ticket that proves they're allowed to access certain parts of the website.&lt;/p&gt;

&lt;p&gt;Imagine this pass is put inside a cookie, just like a tasty treat. So, when you visit the website, your browser automatically carries this cookie (with the pass inside) back and forth to the website with each request you make.&lt;/p&gt;

&lt;p&gt;The website checks this pass to see if it's valid and not expired. If everything looks good, it lets you in. If not, it says, "Sorry, you can't come in."&lt;/p&gt;

&lt;p&gt;This way, you don't have to enter your username and password every time you click on something on the website. It's a convenient and secure way to prove who you are without constantly typing in your credentials.&lt;/p&gt;

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