<?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: Saif Mohamed</title>
    <description>The latest articles on DEV Community by Saif Mohamed (@saifmohamedsv).</description>
    <link>https://dev.to/saifmohamedsv</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%2F988217%2Fd88556aa-5333-438c-a723-e01f1865b6e1.jpeg</url>
      <title>DEV Community: Saif Mohamed</title>
      <link>https://dev.to/saifmohamedsv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saifmohamedsv"/>
    <language>en</language>
    <item>
      <title>What you don't know about sass 🤯</title>
      <dc:creator>Saif Mohamed</dc:creator>
      <pubDate>Mon, 22 Jan 2024 16:19:15 +0000</pubDate>
      <link>https://dev.to/saifmohamedsv/what-you-dont-know-about-sass-1hll</link>
      <guid>https://dev.to/saifmohamedsv/what-you-dont-know-about-sass-1hll</guid>
      <description>&lt;h2&gt;
  
  
  What is sass ?!
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;SASS&lt;/strong&gt; is a CSS pre-processor, A pre-processor is scripting languages that extend the default capabilities of CSS, Like adding logic to it as it is programming language and some special features, we'll talk about them in a minute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Importance and main usages of &lt;strong&gt;SASS&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;One major benefit of using &lt;strong&gt;SASS&lt;/strong&gt; is that it provides developers with a way to organize their stylesheets into individual files and partials, which makes the code easier to read, maintain, and reuse. With Sass, you can break up your stylesheets into smaller components that can be easily imported into other files.&lt;/p&gt;

&lt;p&gt;It enables you to handle typography, layouts, variables and grids in one of the best shapes.&lt;/p&gt;

&lt;h2&gt;
  
  
  SASS vs CSS
&lt;/h2&gt;

&lt;p&gt;First, CSS does not give you the flexibility in managing variables, also one of CSS biggest disadvantages is, when you're doing nesting you should repeat yourself in writing the class names many times, 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;.parent {
  /* your CSS code */
}

.parent .child {
  /* your CSS code */
}

.prent .child .grandChild {
  /* your CSS code */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Main SASS Advantages:
&lt;/h2&gt;

&lt;p&gt;Now let's take a closer look on &lt;strong&gt;SASS&lt;/strong&gt; advantages versus CSS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nesting class names
&lt;/h3&gt;

&lt;p&gt;In &lt;strong&gt;SASS&lt;/strong&gt; you're not forced to do these dummy nesting I mentioned previously 👆&lt;br&gt;
You can nest your class names in more elegant way now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.parent {

  /* CSS code */

  .child {

     /* your CSS code */

     .grandChild {

         /* your CSS code */

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

&lt;/div&gt;



&lt;p&gt;And also you can benifit from this in the &lt;strong&gt;BEM&lt;/strong&gt; naming technique, Let's see how ?!&lt;/p&gt;

&lt;p&gt;If you have the parent &lt;strong&gt;div&lt;/strong&gt; named &lt;code&gt;parent&lt;/code&gt; and it's child named &lt;code&gt;parent__child&lt;/code&gt; (with double underscore)&lt;/p&gt;

&lt;p&gt;You can use it in the sass code 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;.parent {
  /* parent CSS code */

  &amp;amp;__child {
   /* child CSS code */
 }

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Maps
&lt;/h3&gt;

&lt;p&gt;Like many programming languages, in SASS you have the ability to create a &lt;code&gt;map&lt;/code&gt; where you can set key, value pairs and access them or loop over them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// color palette
$colors: (
  "primary": #FFFFFF,
  "secondary": #FFFFFF,
  "error": #FFFFFF,
  "info": #FFFFFF,
);

// You can use it like this to get the value of the key `primary`

$primary-color: map-get($colors, "primary");

// OR

.container {
  background-color: map-get($colors, "primary");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Loops
&lt;/h3&gt;

&lt;p&gt;In &lt;strong&gt;SASS&lt;/strong&gt; you use &lt;code&gt;@each&lt;/code&gt; and &lt;code&gt;@for&lt;/code&gt; to make loops over specific number of items and maybe generate some utility classes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@for $i from 1 through 12 {
  .col-#{$i}-xs {
   box-sizing: border-box;
   flex-grow: 0;
   width: math.div($i * 100%, $grid-columns);
 }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code is going to generate the following classes &lt;br&gt;
&lt;code&gt;.col-1-xs&lt;/code&gt;&lt;br&gt;
&lt;code&gt;.col-2-xs&lt;/code&gt;&lt;br&gt;
...&lt;br&gt;
&lt;code&gt;.col-12-xs&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Conditions
&lt;/h3&gt;

&lt;p&gt;You can use &lt;code&gt;@if&lt;/code&gt; statement in your &lt;strong&gt;SASS&lt;/strong&gt; code to conditionally set CSS properties:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@if ($k == "default") {
 .#{$prefix} {
   #{$property}: $v;
 }
} @else {
 .#{$prefix}-#{$k} {
   #{$property}: $v;
 }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Functions
&lt;/h3&gt;

&lt;p&gt;In &lt;strong&gt;SASS&lt;/strong&gt; you can use &lt;code&gt;functions&lt;/code&gt; to manipulate colors, sizes, or any other css properties and return them.&lt;/p&gt;

&lt;p&gt;Here is an example for a function that lighten and reverse specific colors using two methods in sass &lt;code&gt;complement&lt;/code&gt; and &lt;code&gt;lighten&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;@function light-comp($color) {
  $complement: complement($color);
  $light-complement: lighten($complement, 30%);
  @return $light-complement;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;&lt;strong&gt;SASS&lt;/strong&gt; is a powerful CSS pre-processor that you can use to build modern themes and layouts, also you can build your own CSS custom library using it, like your own version of Bootstrap, and It can reduce your CSS code much more than you think and make it cleaner and more organized.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>sass</category>
      <category>css</category>
      <category>programming</category>
    </item>
    <item>
      <title>Unleashing the Power of React Native</title>
      <dc:creator>Saif Mohamed</dc:creator>
      <pubDate>Wed, 19 Apr 2023 21:31:14 +0000</pubDate>
      <link>https://dev.to/saifmohamedsv/unleashing-the-power-of-react-native-2bjh</link>
      <guid>https://dev.to/saifmohamedsv/unleashing-the-power-of-react-native-2bjh</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;React Native is a popular open-source framework for building mobile applications using JavaScript and React. It was created by Facebook in 2015 and has gained a lot of popularity among developers due to its ease of use, flexibility, and performance. In this article, we will explore the reasons why React Native is a good choice for mobile app development, provide some small examples, and highlight the key differences between React Native, Flutter, and native mobile development.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Why React Native is a good choice ?!&lt;/strong&gt;🤔
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;1. Cross-platform compatibility&lt;/strong&gt;&lt;br&gt;
React Native allows developers to build applications that can run on both iOS and Android platforms, saving development time and costs. Instead of writing separate code for each platform, developers can use a single codebase for both platforms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Easy to learn and use&lt;/strong&gt;&lt;br&gt;
Developers who are familiar with React will find it easy to learn and use React Native. The framework uses a similar syntax and structure to React, making it easy to get started with.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Fast development&lt;/strong&gt;&lt;br&gt;
React Native's hot reloading feature allows developers to see the changes they make in real-time, speeding up the development process. The framework also has a large number of pre-built components, allowing developers to quickly create complex UIs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Performance&lt;/strong&gt;&lt;br&gt;
React Native uses a bridge to communicate between the JavaScript code and the native platform, allowing for smooth and fast performance. The framework also uses native components, ensuring that the app looks and feels like a native app.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Let's take a look at some small examples&lt;/strong&gt; ✅
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Example 1: Creating a basic Hello World application
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import { Text, View } from 'react-native';

const App = () =&amp;gt; {
  return (
    &amp;lt;View&amp;gt;
      &amp;lt;Text&amp;gt;Hello World!&amp;lt;/Text&amp;gt;
    &amp;lt;/View&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;h5&gt;
  
  
  Example 2: Creating a button that changes color when pressed
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';
import { View, Button } from 'react-native';

const App = () =&amp;gt; {
  const [color, setColor] = useState('red');

  const changeColor = () =&amp;gt; {
    setColor('blue');
  }

  return (
    &amp;lt;View&amp;gt;
      &amp;lt;Button title="Change color" onPress={changeColor} /&amp;gt;
      &amp;lt;View style={{ backgroundColor: color, height: 100, marginTop: 20 }}&amp;gt;&amp;lt;/View&amp;gt;
    &amp;lt;/View&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;Key Differences between React Native, Flutter, and Native Mobile Development&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;1. Language&lt;/strong&gt;&lt;br&gt;
React Native uses JavaScript, while Flutter uses Dart. Native mobile development uses platform-specific languages like Java or Kotlin for Android and Swift or Objective-C for iOS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Performance&lt;/strong&gt;&lt;br&gt;
Flutter uses its own rendering engine, which allows for fast and smooth performance. React Native uses a bridge to communicate between the JavaScript code and the native platform, which can sometimes lead to performance issues. Native mobile development offers the best performance since it directly uses the platform-specific APIs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Tooling&lt;/strong&gt;&lt;br&gt;
Flutter comes with a complete set of development tools, including an integrated&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>mobile</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Vite.js: The Speedy Build Tool Revolutionizing JavaScript Development</title>
      <dc:creator>Saif Mohamed</dc:creator>
      <pubDate>Mon, 03 Apr 2023 10:00:00 +0000</pubDate>
      <link>https://dev.to/saifmohamedsv/vitejs-the-speedy-build-tool-revolutionizing-javascript-development-4j10</link>
      <guid>https://dev.to/saifmohamedsv/vitejs-the-speedy-build-tool-revolutionizing-javascript-development-4j10</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Vite.js is a modern build tool for JavaScript applications. It was developed by Evan You, the creator of the popular front-end framework Vue.js. Vite.js focuses on speed and developer experience, offering a blazing-fast development server and an optimized build process. In this article, we will explore the good and the bad of Vite.js.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Pros&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1- Fast Development Server&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;Vite.js comes with a development server that is optimized for speed. It leverages the native ES modules in modern browsers to serve the application without the need for bundling. This makes the development experience much faster than traditional build tools like Webpack.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2- Build Optimizations&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;Vite.js uses a highly optimized build process that leverages the latest features of modern browsers. It generates highly optimized code, resulting in faster load times and smaller bundle sizes.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3- Vue.js Integration&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;Vite.js was developed by the creator of Vue.js, so it naturally has excellent integration with the Vue.js framework. Vite.js supports Vue.js single-file components out of the box, making it a great choice for Vue.js developers.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4- Plugin System&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;Vite.js has a powerful plugin system that allows developers to extend its functionality. There are already many plugins available, including ones for TypeScript, CSS preprocessors, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;5- Customizable Configuration&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;Vite.js provides a simple and intuitive configuration file that allows developers to customize their build process. This makes it easy to tailor the build process to the needs of the application.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Cons&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1- Limited Browser Support:
&lt;/h3&gt;

&lt;p&gt;Vite.js leverages the latest features of modern browsers, so it has limited support for older browsers. This may be a concern for applications that need to support older browsers.&lt;/p&gt;

&lt;h3&gt;
  
  
  2- Limited Language Support:
&lt;/h3&gt;

&lt;p&gt;Vite.js is primarily designed for JavaScript applications, so it has limited support for other languages like TypeScript, although there are plugins available to address this.&lt;/p&gt;

&lt;h3&gt;
  
  
  3- Immaturity:
&lt;/h3&gt;

&lt;p&gt;Vite.js is a relatively new build tool, so it may lack some of the features and stability of more established build tools like Webpack. However, it has gained a lot of popularity and momentum in the community.&lt;/p&gt;

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

&lt;p&gt;Vite.js is a modern and fast build tool that offers a great development experience for JavaScript applications. Its focus on speed and developer experience makes it a popular choice for many developers, particularly those using Vue.js. While it may have some limitations, its strengths make it a great choice for modern web development projects.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Do not forget to follow me for more technical post 🥰 ✅&lt;/code&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>vite</category>
    </item>
  </channel>
</rss>
