<?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: Shaik Shahbaaz Alam</title>
    <description>The latest articles on DEV Community by Shaik Shahbaaz Alam (@shahbaazx786).</description>
    <link>https://dev.to/shahbaazx786</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%2F942477%2F74a5ad67-d765-45a4-904c-a06986514ced.jpeg</url>
      <title>DEV Community: Shaik Shahbaaz Alam</title>
      <link>https://dev.to/shahbaazx786</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shahbaazx786"/>
    <language>en</language>
    <item>
      <title>What is RxJS? And Why Should You Care?</title>
      <dc:creator>Shaik Shahbaaz Alam</dc:creator>
      <pubDate>Wed, 09 Apr 2025 14:55:29 +0000</pubDate>
      <link>https://dev.to/shahbaazx786/what-is-rxjs-and-why-should-you-care-2724</link>
      <guid>https://dev.to/shahbaazx786/what-is-rxjs-and-why-should-you-care-2724</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;بسم الله&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction (How Rxjs Works):
&lt;/h2&gt;

&lt;p&gt;Let’s say you are watching a water pipe. Every few seconds, water drops come out of it. You don’t know exactly when the water drops will come or how many drops will come. You just know that they will, and your job is to react to / catch those drops.&lt;/p&gt;

&lt;p&gt;And these collected drops can be utilized later for drinking, filling a balloon or any other task.&lt;/p&gt;

&lt;p&gt;Seems like an easy job right?. but in terms of programming this is pretty unrealistic and complex to tackle.&lt;/p&gt;

&lt;p&gt;This is what RxJS is for — working with things that happen over time and you may or may not know when that time is..&lt;/p&gt;

&lt;h3&gt;
  
  
  In other words:
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;RxJS lets you treat everything that happens over time — like clicks, inputs, or API responses — as a stream of data that you can watch, transform, combine, and control, all with elegance and power.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What is RXJS?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Now we know how Rxjs works, but let's breakdown what Rxjs really is..&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RxJS&lt;/strong&gt; stands for &lt;strong&gt;Reactive Extensions for JavaScript&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It's a library that helps you handle asynchronous data in a clean, powerful, and reactive way. And remember, this is a library (a set of code that can be reused).&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Asynchronous means "not now" — things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A button click.&lt;/li&gt;
&lt;li&gt;A key press.&lt;/li&gt;
&lt;li&gt;An API response.&lt;/li&gt;
&lt;li&gt;A timer (My favorite).&lt;/li&gt;
&lt;li&gt;Live search input.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Instead of writing "what to do when something happens" in 100 places with multiple if checks, multiple internal methods, callbacks etc, RxJS lets you describe the flow of data as it happens — like a story.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Core Concepts:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you are working with Rxjs then you will be commonly hearing this terms like Streams, Observables, Observer, Subscription, Operators, Subject, Schedulers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In RxJS, everything is a stream of values over time.&lt;br&gt;
Stream = Observable – think of it like a water pipe.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You listen to the stream by subscribing to it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can transform, filter, or combine streams using operators (we’ll see this in later posts).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1.Streams:
&lt;/h3&gt;

&lt;p&gt;The sequence of ongoing events or data is considered as a stream as Rxjs works only if the stream is flowing.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think of it as:

&lt;ul&gt;
&lt;li&gt;A timeline of values.&lt;/li&gt;
&lt;li&gt;Like a video stream: each frame is a value, and it keeps going until it ends (or errors out).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Streams are represented by Observables. and &lt;strong&gt;of()&lt;/strong&gt; is used to create an observable when known data.&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// this is creating an observable.
const fruitStream$ = of('🍎 Apple', '🍌 Banana', '🍇 Grape');

// this is subsribing to the observable (remember this).
fruitStream$.subscribe({
  next: fruit =&amp;gt; console.log('Got fruit:', fruit),       // When we receive data
  complete: () =&amp;gt; console.log('No more fruits! ✅'),     // When it finishes
  error: err =&amp;gt; console.error('Something went wrong:', err), // If error occurs
});


Output:
Got fruit: 🍎 Apple
Got fruit: 🍌 Banana
Got fruit: 🍇 Grape
No more fruits! ✅
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2.Observables:
&lt;/h3&gt;

&lt;p&gt;An Observable is like a blueprint for a stream.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think of it as:

&lt;ul&gt;
&lt;li&gt;A recipe that defines how data will be sent.&lt;/li&gt;
&lt;li&gt;It does nothing until someone subscribes to it.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Observable is commonly used to create the Observable stream when data or completion time is unknown.&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Observable } from 'rxjs';

// Notice we are using "Observable()" here instead of "of()"
const JunkFoodStream$ = new Observable(observer =&amp;gt; {
  observer.next('🍕');
  observer.next('🍔');
  observer.complete();
});

// this is subsribing to the observable (remember this).
fruitStream$.subscribe({
  next: food =&amp;gt; console.log('Got Food:', food),       // When we receive data
  complete: () =&amp;gt; console.log('No more JunkFood! ✅'),     // When it finishes
  error: err =&amp;gt; console.error('Something went wrong:', err), // If error occurs


Output:
Got Food: '🍕'
Got Food: '🍔'
No more JunkFood! ✅

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  3.Observer:
&lt;/h3&gt;

&lt;p&gt;An Observer is the good guy who &lt;strong&gt;attentively listens&lt;/strong&gt; to every class in first bench.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think of it as:

&lt;ul&gt;
&lt;li&gt;A listener or a handler.&lt;/li&gt;
&lt;li&gt;We are already familiar with this in above examples😀.&lt;/li&gt;
&lt;li&gt;It has methods like:&lt;/li&gt;
&lt;li&gt;next() – when a new value is emitted.&lt;/li&gt;
&lt;li&gt;error() – when something goes wrong.&lt;/li&gt;
&lt;li&gt;complete() – when the stream is done.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;If we want to store the &lt;strong&gt;data-producing or Emitting logic&lt;/strong&gt; in one variable then it is called as &lt;strong&gt;Observable&lt;/strong&gt;. and if we want to store the &lt;strong&gt;subscribing logic, handling Emitted Values logic&lt;/strong&gt; then it is called as &lt;strong&gt;Observer&lt;/strong&gt;.&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Observable } from 'rxjs';

// 1. Create the Observable (animal stream)
const animalStream$ = new Observable(observer =&amp;gt; {
  observer.next('🐶 Dog');
  observer.next('🐱 Cat');
  observer.next('🐻 Bear');
  observer.complete(); // We’re done sending animals
});

// 2. Define the Observer (the guy listening to the animal stream)
const animalObserver = {
  next: animal =&amp;gt; console.log('I got an animal:', animal),
  error: err =&amp;gt; console.error('Oops! Error happened:', err),
  complete: () =&amp;gt; console.log('No more animals! ✅')
};

// 3. Subscribe the Observer to the Observable
animalStream$.subscribe(animalObserver);

Output:
I got an animal: 🐶 Dog
I got an animal: 🐱 Cat
I got an animal: 🐻 Bear
No more animals! ✅

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  4.Subscription:
&lt;/h3&gt;

&lt;p&gt;A Subscription is the connection between an Observable and an Observer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think of it as:

&lt;ul&gt;
&lt;li&gt;Turning the pipe ON so data can start flowing&lt;/li&gt;
&lt;li&gt;You can unsubscribe to turn the pipe OFF and stop listening.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { interval } from 'rxjs'; // don't worry this is same as setInterval in JS.

const timer$ = interval(1000); // Emits 0, 1, 2, 3... every 1 second and goes on infintely.

// Subscribe to the stream — this starts the timer
const subscription = timer$.subscribe(count =&amp;gt; {
  console.log(`⏰ Tick: ${count}`);
});

// Automatically unsubscribe after 5 seconds
setTimeout(() =&amp;gt; {
  subscription.unsubscribe(); // Stops the stream
  console.log('🛑 Timer stopped after 5 seconds');
}, 5000);
// Though I have used setTimout here this for easy understanding. 
This can be replaced with your own logic to unsub the subscription.

Output:
⏰ Tick: 0
⏰ Tick: 1
⏰ Tick: 2
⏰ Tick: 3
⏰ Tick: 4
🛑 Timer stopped after 5 seconds

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  5.Operators:
&lt;/h3&gt;

&lt;p&gt;Operators are tools that you use to transform, filter, or combine data in a stream.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think of it as:

&lt;ul&gt;
&lt;li&gt;LEGO pieces you can chain together to make something you want.&lt;/li&gt;
&lt;li&gt;Mostly operators are used inside &lt;strong&gt;.pipe(...)&lt;/strong&gt; to change or transform the data stream into our desirable format.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Commonly operators follow subscribe --&amp;gt; select --&amp;gt; transform --&amp;gt; unsubscribe approach.&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example-1:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { of } from 'rxjs';
import { filter, map } from 'rxjs/operators';

// 1. Create a stream of numbers
const numbers$ = of(1, 2, 3, 4, 5);

// 2. Use pipe to add operators
numbers$.pipe(
  filter(num =&amp;gt; num % 2 === 0), // Only even numbers
  map(num =&amp;gt; num * 2)           // Double them
).subscribe(result =&amp;gt; {
  console.log('✅ Final Output:', result); // and finally print them.
});

Output:
✅ Final Output: 4
✅ Final Output: 8

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

&lt;/div&gt;



&lt;h4&gt;
  
  
  Example - 2: (Pls don't get scared, Just close your eyes and take long breathe, it gets easier)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// This is close to a real-world search bar implementation.
import { fromEvent } from 'rxjs';
import { map, debounceTime, distinctUntilChanged } from 'rxjs/operators';

const input = document.getElementById('search-box') as HTMLInputElement; // this is just DOM searching.

fromEvent(input, 'input').pipe(
  debounceTime(500),                        // ⏳ Wait 0.5s after typing stops
  map(e =&amp;gt; (e.target as HTMLInputElement).value.trim()),  // 🧼 Clean input value by removing extra spaces.
  distinctUntilChanged(),                   // 🚫 Ignore if same as last value
  map(value =&amp;gt; value.toUpperCase())         // 🔠 Convert to UPPERCASE
).subscribe(searchTerm =&amp;gt; {
  console.log('🔍 Search for:', searchTerm);
});

Image User is typing like this:
h → he → hel → hell → hello → hello (pause) → hello (again) → help

Output:
🔍 Search for: HELLO
🔍 Search for: HELP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It waits 500ms before reacting to input (debounce).&lt;/li&gt;
&lt;li&gt;It ignores repeated 'hello' (distinctUntilChanged).&lt;/li&gt;
&lt;li&gt;It transforms to uppercase (map).&lt;/li&gt;
&lt;li&gt;And finally the result is logged when all conditions are met.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6.Subject: (One of my favorites).
&lt;/h3&gt;

&lt;p&gt;A Subject is like an Observable you can push data into manually.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think of it as:

&lt;ul&gt;
&lt;li&gt;A microphone 🎤 that broadcasts data to everyone who’s listening.
&lt;/li&gt;
&lt;li&gt;It’s both:&lt;/li&gt;
&lt;li&gt;An Observable (others can subscribe to it)&lt;/li&gt;
&lt;li&gt;An Observer (you can push values into it using .next())&lt;/li&gt;
&lt;li&gt;Sounds Sus right? 😂&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Don't worry this is by far the heavily used thing in Rxjs apps.&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Subject } from 'rxjs';

// 1. Create a Subject (notification system)
const notification$ = new Subject&amp;lt;string&amp;gt;();

// 2. Component A subscribes
notification$.subscribe(msg =&amp;gt; {
  console.log('📱 Component A got:', msg);
});

// 3. Component B subscribes
notification$.subscribe(msg =&amp;gt; {
  console.log('💻 Component B got:', msg);
});

// 4. Send a notification
notification$.next('🔔 New message received!');

// 5. Another one
notification$.next('📦 Your order has been shipped.');

// 6. Complete the subject (shut down the notification system)
notification$.complete();

// 7. This will NOT be received by anyone as stream ended.
notification$.next('❗ You shouldn’t see this.');

Output:
📱 Component A got: 🔔 New message received!
💻 Component B got: 🔔 New message received!
📱 Component A got: 📦 Your order has been shipped.
💻 Component B got: 📦 Your order has been shipped.

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

&lt;/div&gt;



&lt;p&gt;Notice how both the subscribers got the same message?. and the data we sent is complete manual.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's basically *&lt;em&gt;multicast *&lt;/em&gt;— one source, many listeners.&lt;/li&gt;
&lt;li&gt;Also, we can use &lt;code&gt;notification$.complete('green apples 🍏🍏');&lt;/code&gt; to end the stream right away.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7.Schedulers:
&lt;/h3&gt;

&lt;p&gt;A Scheduler controls when and how a task (like emitting a value) is runs — like a clock or thread manager in RxJS.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It determines what executes when and where.&lt;/li&gt;
&lt;li&gt;Think of it as:

&lt;ul&gt;
&lt;li&gt;A clock manager ⏰ for your streams&lt;/li&gt;
&lt;li&gt;Schedulers let you shift execution between:&lt;/li&gt;
&lt;li&gt;Synchronous (now)&lt;/li&gt;
&lt;li&gt;Asynchronous (later)&lt;/li&gt;
&lt;li&gt;Animation Frame (next frame)&lt;/li&gt;
&lt;li&gt;Queue (microtask-like)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;This is Advanced topic, so you might not see this in every codebase. As this is used for timing, performance, or multithreading-like behavior in JS.&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { of, asyncScheduler, queueScheduler } from 'rxjs';
import { observeOn } from 'rxjs/operators';

// Log before any stream
console.log('🔵 Start');

// Normal (synchronous) observable
of('🍕 sync').subscribe(value =&amp;gt; console.log('✅', value));

// Queued execution (after current task completes)
of('🍔 queued').pipe(observeOn(queueScheduler)).subscribe(value =&amp;gt; console.log('📦', value));

// Async execution (delayed, in next JS macro-task)
of('🍟 async').pipe(observeOn(asyncScheduler)).subscribe(value =&amp;gt; console.log('🕒', value));

// Log after setting up streams
console.log('🔴 End');

Output:
🔵 Start
✅ 🍕 sync
🔴 End
📦 🍔 queued
🕒 🍟 async
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Well, how the turn tables? 😂.&lt;br&gt;
No, this is actually how JS works. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;console logging statements are executed synchronously.&lt;/li&gt;
&lt;li&gt;And synchronous tasks are executed as usual.&lt;/li&gt;
&lt;li&gt;then we queued the item so it will run in parallel or in multithread.&lt;/li&gt;
&lt;li&gt;and then Finally Async code.&lt;/li&gt;
&lt;li&gt;Even though Async code is micro-task and is higher priority than settimeout, setinterval. We are using async sheduler here which is macro-task and not the promises / async awaits which are micro-tasks, that's why we got async at last.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And.......... that's it folks!.&lt;/p&gt;

&lt;p&gt;This was a quick and easy introduction to Rxjs and its beginner terminology.&lt;/p&gt;

&lt;p&gt;Let me know if there is any doubt / mistake in the comments.&lt;br&gt;
And I'll try to cover Rxjs in later posts.&lt;/p&gt;

&lt;p&gt;Peace! &lt;/p&gt;

</description>
      <category>rxjs</category>
      <category>angular</category>
      <category>reactiveprogramming</category>
      <category>asynchronousprogramming</category>
    </item>
    <item>
      <title>Setting up react Native + Expo + Tailwind + Gluestack-ui v2</title>
      <dc:creator>Shaik Shahbaaz Alam</dc:creator>
      <pubDate>Mon, 02 Sep 2024 11:53:57 +0000</pubDate>
      <link>https://dev.to/shahbaazx786/setting-up-react-native-expo-tailwind-gluestack-ui-v2-430e</link>
      <guid>https://dev.to/shahbaazx786/setting-up-react-native-expo-tailwind-gluestack-ui-v2-430e</guid>
      <description>&lt;h2&gt;
  
  
  Intro:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Well I'm new to react native world but not new to the web as i've been a full stack developer for 3+ years now.. And i'm starting to know a bit about mobile development as well.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the first week I started with a simple app of changing background color of the app to making a wallpaper app in the first month to utilizing the tools and frameworks in the app development as well..&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Well, who doesn't like their favorite frameworks and tools to work everywhere.. Also it kind of become tedious to write styles like css when you already know tailwind. And if you are coming from a meta framework like Nextjs, Angular, then this post is definately for you.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What shall we do in this post:
&lt;/h2&gt;

&lt;p&gt;1) Setting / creating Expo app (&lt;strong&gt;App Router&lt;/strong&gt;).&lt;br&gt;
2) Installing and configuring &lt;strong&gt;Tailwind **in expo.&lt;br&gt;
3) Installing and configuring **Gluestackui v2&lt;/strong&gt; library.&lt;/p&gt;
&lt;h2&gt;
  
  
  1.Creating an expo app.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First run the below command to create an expo app and if you want to have latest sdk (currently it is 50).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npx create-expo-app@latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Or to create a project in current folder and it takes the name of the folder.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx create-expo-app@latest ./&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Follow &lt;a href="https://docs.expo.dev/get-started/create-a-project/" rel="noopener noreferrer"&gt;this&lt;/a&gt; document for detailed info on creating an Expo App:&lt;/p&gt;
&lt;h2&gt;
  
  
  2.Installing Tailwind (Long Process Ahead).
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Here point to be noted we are going to use a library called NativeWind that acts as a preprocessor / mediator between our code and tailwind styles.&lt;/li&gt;
&lt;li&gt;This library again comes in 2 versions (v2 and v4(currently in beta)).&lt;/li&gt;
&lt;li&gt;v2 will &lt;strong&gt;not ** support Gluestackui v2 so Im installing **v4&lt;/strong&gt;  nativewind now.
&lt;a href="https://www.nativewind.dev/" rel="noopener noreferrer"&gt;Refernce Link&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run the below command&lt;br&gt;
&lt;code&gt;npx expo install nativewind@^4.0.1 react-native-reanimated tailwindcss&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then run the next command.&lt;br&gt;
&lt;code&gt;npx pod-install&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After this create tailwind.config.ts file at root level using below command.&lt;br&gt;
&lt;code&gt;npx tailwindcss init&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;4.Then update the created &lt;strong&gt;tailwind.config.js&lt;/strong&gt; file completely with below snippet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** @type {import('tailwindcss').Config} */
module.exports = {
  // NOTE: Update this to include the paths to all of your component files.
  content: ["./app/**/*.{js,jsx,ts,tsx}"],
  presets: [require("nativewind/preset")],
  theme: {
    extend: {},
  },
  plugins: [],
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.Now create  a &lt;strong&gt;global.css&lt;/strong&gt; file at root level and paste the below directives in that css file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tailwind base;
@tailwind components;
@tailwind utilities;

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

&lt;/div&gt;



&lt;p&gt;6.Now check if you have &lt;strong&gt;babel.config.js&lt;/strong&gt; file and paste the below configuration in that file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = function (api) {
  api.cache(true);
  return {
    presets: [
      ["babel-preset-expo", { jsxImportSource: "nativewind" }],
      "nativewind/babel",
    ],
  };
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7.Now check if you have a file called &lt;strong&gt;metro.config.js&lt;/strong&gt; and if not then run the below command to create the file&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx expo customize metro.config.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And then paste the below snippet into the created file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { getDefaultConfig } = require("expo/metro-config");
const { withNativeWind } = require('nativewind/metro');

const config = getDefaultConfig(__dirname)

module.exports = withNativeWind(config, { input: './global.css' })

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

&lt;/div&gt;



&lt;p&gt;8.At this step, if you are using pages router, then &lt;strong&gt;import ** the  **global.css&lt;/strong&gt; file in &lt;strong&gt;App.tsx&lt;/strong&gt;. Or, if you are using App Router, then import the global.css file in the root &lt;strong&gt;_layout.tsx&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;Ex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Import your global CSS file
import "../global.css"

export default RootLayout(){
// stack routes here
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;9.This is an optional step and can only be done if you want to have &lt;strong&gt;typescript support for tailwind&lt;/strong&gt; in your project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the root of your project create a new file named **nativewind-env.d.ts **and paste the triple-slash-directive in that file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;/// &amp;lt;reference types="nativewind/types" /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That's it now your tailwind should be working fine..&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up Gluestack-ui v2:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://gluestack.io/ui/docs/home/getting-started/installation" rel="noopener noreferrer"&gt;Reference Link&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run the command &lt;code&gt;npx gluestack-ui init&lt;/code&gt; to **initialize **the library in expo app router project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This shall create all files and setup basic configurations properly and works great in &lt;strong&gt;pages router&lt;/strong&gt;, but we have to do &lt;strong&gt;few tweaks&lt;/strong&gt; to make it work properly &lt;strong&gt;app router&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Change 1:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In babel.config.js &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;replace the code with below snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = function (api) {
  api.cache(true);
  return {
    presets: [["babel-preset-expo", {
      jsxImportSource: "nativewind"
    }], "nativewind/babel"],
    plugins: [
      ["module-resolver", {
        root: ["./"],
        alias: {
          "@": "./"
        }
      }]
    ],
  };
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Change 2&lt;/strong&gt;:&lt;br&gt;
Make sure to add &lt;strong&gt;./app&lt;/strong&gt; and &lt;strong&gt;./components&lt;/strong&gt; entries in tailwind.config.js file's &lt;strong&gt;content array&lt;/strong&gt;, so that files from that location also gets checked for tailwind classes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'media',
  content: [
    './app/**/*.{js,jsx,ts,tsx}',
    './components/**/*.{js,jsx,ts,tsx}',
    './src/**/*.{html,js,jsx,ts,tsx}',
    './src/core-components/**/**/*.{html,js,jsx,ts,tsx}',
    './src/components/**/*.{html,js,jsx,ts,tsx,mdx}',
    './src/hooks/**/*.{html,js,jsx,ts,tsx,mdx}',
  ],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Change 3&lt;/strong&gt;:&lt;br&gt;
Now finally replace the contents of metro.config.js with the below snippet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { getDefaultConfig } = require("expo/metro-config");
const { withNativeWind } = require('nativewind/metro');

const config = getDefaultConfig(__dirname)

module.exports = withNativeWind(config, { input: './global.css' })
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Aaaaannnnnndddd That's it..&lt;/p&gt;

&lt;p&gt;you can go to components and install any components and use them in your expo project now.!!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Adding external domains in nextjs project.</title>
      <dc:creator>Shaik Shahbaaz Alam</dc:creator>
      <pubDate>Wed, 29 May 2024 11:49:47 +0000</pubDate>
      <link>https://dev.to/shahbaazx786/adding-external-domains-in-nextjs-project-48p2</link>
      <guid>https://dev.to/shahbaazx786/adding-external-domains-in-nextjs-project-48p2</guid>
      <description>&lt;p&gt;Well this is a rather simple post on how to setup external domains and use them in our nextjs projects.&lt;/p&gt;

&lt;p&gt;if you have ever came across below error then this post is for you.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The "images.domains" configuration is deprecated. Please use "images.remotePatterns" configuration instead.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Old method(Kind of deprecated from Nextjs 14):
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/** @type {import('next').NextConfig} */&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nextConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;images&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;domains&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;images.unsplash.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;i.pravatar.cc&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;nextConfig&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Upto nextjs 13 we need to just add all the external hostnames in domains array of nextConfig; &lt;/li&gt;
&lt;li&gt;And this will automatically allow the access of specified domains in our project.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  New Method (Applicable from v14):
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/** @type {import('next').NextConfig} */&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nextConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;images&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;remotePatterns&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;span class="na"&gt;protocol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;images.unsplash.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;**&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;protocol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;i.pravatar.cc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;**&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;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;nextConfig&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The only difference here is we rename the domains to remotePatterns array which accepts an object of varied parameters like protocol, hostname,port, pathname etc.&lt;/li&gt;
&lt;li&gt;And if you are just trying to make it work in your personal project you can just copy the above New method.&lt;/li&gt;
&lt;li&gt;Otherwise you can specify the exact hostname, protocols, port numbers and acceptable pathnames. Ex: images.unsplash.com/**/user12 etc.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>nextjs</category>
      <category>nextconfig</category>
      <category>react</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Behaviour Subject In Angular (rxjs)</title>
      <dc:creator>Shaik Shahbaaz Alam</dc:creator>
      <pubDate>Fri, 05 Apr 2024 02:02:31 +0000</pubDate>
      <link>https://dev.to/shahbaazx786/behaviour-subject-in-angular-1835</link>
      <guid>https://dev.to/shahbaazx786/behaviour-subject-in-angular-1835</guid>
      <description>&lt;p&gt;Behaviour Subject is one of the useful features in rxjs which comes pre installed in angular 9+&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Subject?
&lt;/h2&gt;

&lt;p&gt;A RxJS Subject is a special type of &lt;strong&gt;Observable&lt;/strong&gt; that allows values to be multicasted(means one observable can be used by multiple / all components) to many Observers. While plain Observables are unicast (each subscribed Observer owns an independent execution of the Observable), Subjects are multicast.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz2587v88c2nn5qhs9w8y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz2587v88c2nn5qhs9w8y.png" alt="Creating the subject" width="800" height="851"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And then utilize this observable in other components.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn64w11l34kawntgc91o2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn64w11l34kawntgc91o2.png" alt="Utilizing the subject" width="687" height="1089"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To use any data in different components and just store it once and use everywhere in the angular project.
Drawback:&lt;/li&gt;
&lt;li&gt;This sometimes gives old, unexpected values when used with APIs. So, when working with API's we can use AsyncSubject.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>angular</category>
      <category>rxjs</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
