<?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: Tevpro Developers</title>
    <description>The latest articles on DEV Community by Tevpro Developers (@tevpro).</description>
    <link>https://dev.to/tevpro</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%2F787140%2Fa440a0fe-23b2-42c9-b8a1-41169002d9ef.jpg</url>
      <title>DEV Community: Tevpro Developers</title>
      <link>https://dev.to/tevpro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tevpro"/>
    <language>en</language>
    <item>
      <title>Comparing time based operators in RxJS: debounce, throttle, sample, and audit</title>
      <dc:creator>Tevpro Developers</dc:creator>
      <pubDate>Mon, 04 Apr 2022 16:03:03 +0000</pubDate>
      <link>https://dev.to/tevpro/comparing-time-based-operators-in-rxjs-debounce-throttle-sample-and-audit-b2j</link>
      <guid>https://dev.to/tevpro/comparing-time-based-operators-in-rxjs-debounce-throttle-sample-and-audit-b2j</guid>
      <description>&lt;p&gt;In RxJS, a Pipeable Operator is essentially a pure function which takes one Observable as input and generates another Observable as output. Pipeable Operators return a new observable without modifying the original, inputted Observable. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are Timing Operators?&lt;/strong&gt;&lt;br&gt;
Timing operators are a type of Pipeable Operators used to control when an Observable's values will be emitted. To control the flow of emitted values of an Observable, you can use debounceTime(), throttleTime(), sampleTime(), and auditTime() depending on the task at hand.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;debounceTime()&lt;/strong&gt;&lt;br&gt;
debounceTime() emits the latest value after a pause/delay from when the latest value was emitted. &lt;br&gt;
A popular use case for debounceTime() is to control when a user's input is "accepted" as to only take the last emitted value after a user pauses typing after a specified amount of time.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Tzjnp8A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1jwi8yahh0t0a4qjgpy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Tzjnp8A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1jwi8yahh0t0a4qjgpy.png" alt="Image description" width="880" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;throttleTime()&lt;/strong&gt;&lt;br&gt;
throttleTime() is similar to debounceTime(). The difference is that throttleTime() emits a value first, then ignores values during a timed window and continues to repeat this pattern, whereas debounceTime() does not emit a value before the delayed windows start.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2gX7dpWt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xhx1p5u3csplv8h0hdc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2gX7dpWt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xhx1p5u3csplv8h0hdc.png" alt="Image description" width="880" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;sampleTime()&lt;/strong&gt;&lt;br&gt;
sampleTime() emits the latest value at the end of each interval. Any earlier values are ignored, and silence window is repeated after subscription. Similarly, use sample() to sample an observable at any given time instead of a routine, preset interval. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--voUQPkc1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/929dqp18cmo1k0w072c6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--voUQPkc1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/929dqp18cmo1k0w072c6.png" alt="Image description" width="880" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;auditTime()&lt;/strong&gt;&lt;br&gt;
auditTime() ignores source values for the duration you specify after an emitted value. Silence window is triggered by emitted values from the source.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mADpzYrB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/67mi01man28cbyathai6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mADpzYrB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/67mi01man28cbyathai6.png" alt="Image description" width="880" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
There are many ways to control the flow of emitted values of an observable, including filtering pipes and timing pipes. Depending on the timing behavior you need, take a look at debounceTime(), throttleTime(), sampleTime(), and auditTime() to see if these behaviors match what you are looking for. If none of these work for you, check out the other RxJS operators available.&lt;/p&gt;

&lt;p&gt;Hope you enjoyed this article and of course feel free to &lt;a href="https://www.tevpro.com/contact-us"&gt;reach out&lt;/a&gt; with additional questions. Be sure to follow us on Twitter to continue learning RxJS and subscribe to our blog for more amazing content. &lt;/p&gt;

</description>
      <category>rxjs</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Integrating TypeScript into your NextJS app</title>
      <dc:creator>Tevpro Developers</dc:creator>
      <pubDate>Thu, 06 Jan 2022 12:57:41 +0000</pubDate>
      <link>https://dev.to/tevpro/integrating-typescript-into-your-nextjs-app-49ib</link>
      <guid>https://dev.to/tevpro/integrating-typescript-into-your-nextjs-app-49ib</guid>
      <description>&lt;p&gt;By Kim Pham, Senior Front End Developer, Tevpro&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A guide to installing Typescript in NextJS apps.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;NextJS is a wrapper for ReactJS, providing a more comprehensive framework solution to the popular front-end development library. NextJS allows for developers to use many useful "out-of-the-box" features that would otherwise have to be manually added to the relevant React apps. &lt;/p&gt;

&lt;p&gt;*&lt;em&gt;NestJS not only enhances React – it uses React. *&lt;/em&gt;&lt;br&gt;
"You still write React code. You still build React components, but it’s a framework for production because it adds all those missing features that you typically need to add to React apps to prepare them for production and solve common problems." - Imran Farooq in an Enlear Academy Article&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What features does NextJS offer?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React itself is minimal, but extremely flexible in its ability to extend unto other features. In contrast, NextJS has a variety of features already included to help developers build their apps, including: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/docs/basic-features/pages#pre-rendering"&gt;Prerendering&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/docs/basic-features/pages#server-side-rendering"&gt;Server-side rendering&lt;/a&gt; (SSR)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/docs/basic-features/pages#static-generation-recommended"&gt;Static export&lt;/a&gt; (SSG)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/going-to-production#reducing-javascript-size"&gt;Automatic build size optimization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/advanced-features/compiler"&gt;Faster development compilation &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/docs/basic-features/pages"&gt;Page based routing&lt;/a&gt; (with support for dynamic routes)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/docs/routing/introduction#linking-between-pages"&gt;Client-side routing&lt;/a&gt; with prefetching&lt;/li&gt;
&lt;li&gt;Built-in CSS and Sass support, and support for any CSS-in-JS library&lt;/li&gt;
&lt;li&gt;API routes to build API endpoints with Serverless Functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Steps to convert your NextJS application to use TypeScript&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a terminal and navigate to the directory of your project's root folder&lt;/li&gt;
&lt;li&gt;Run the command &lt;code&gt;npm install touch-cli&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run the command &lt;code&gt;touch tsconfig.json&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;If touch command is not found:&lt;/em&gt;

&lt;ul&gt;
&lt;li&gt;run &lt;code&gt;npm install touch-cli -g&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;touch tsconfig.json&lt;/code&gt; again&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Run the command &lt;code&gt;npm install --save-dev typescript @types/react&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run nest (normally &lt;code&gt;npm run dev&lt;/code&gt; or &lt;code&gt;yarn dev&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Start converting your js files into ts/tsx files!

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Any js files that contain jsx will need to become tsx files&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Final thoughts&lt;/strong&gt;&lt;br&gt;
We hope you found this article useful. If you encounter any difficulties or unexpected "gotchas" – don't hesitate to &lt;a href="https://tevpro.com/contact-us/"&gt;reach out to us&lt;/a&gt; for help in converting your app. &lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;Photo by &lt;a href="https://unsplash.com/@jannerboy62?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Nick Fewings&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>typescript</category>
      <category>nextjs</category>
      <category>tutorial</category>
      <category>react</category>
    </item>
    <item>
      <title>How to use the RxJS partition function</title>
      <dc:creator>Tevpro Developers</dc:creator>
      <pubDate>Thu, 06 Jan 2022 12:47:14 +0000</pubDate>
      <link>https://dev.to/tevpro/how-to-use-the-rxjs-partition-function-372c</link>
      <guid>https://dev.to/tevpro/how-to-use-the-rxjs-partition-function-372c</guid>
      <description>&lt;p&gt;By Kim Pham, Senior Front-End Developer, Tevpro&lt;/p&gt;

&lt;p&gt;Here is a &lt;a href="https://tevpro.com/blog/how-to-use-the-rxjs-partition-function/"&gt;quick guide&lt;/a&gt; for using the &lt;strong&gt;partition() function&lt;/strong&gt; in place of if/else statements inside .subscribe() when working with an RxJS Observable.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;em&gt;Please note that this article discusses the partition function, **not operator&lt;/em&gt;*.  See RxJS documentation for the deprecation of partition operator.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is an Observable?&lt;/strong&gt;&lt;br&gt;
An RxJS Observable produces values over time and allows handling of various asynchronous streams of data. Much of logic and other handling is defined in the .subscribe() function of an observable, but operators and functions further enhance the managing logic and events. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using the partition() function&lt;/strong&gt;&lt;br&gt;
Logic for values emitted by an Observable can be implemented inside the .subscribe() block – this includes function calls, conditional/if-else statements, and more. However, instead of an if/else statement, you can split an observable into two separate observables based on a condition that you provide using the partition function. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example usage of partition() with a Subject&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X_im167V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y35829t927sf8l9g8xsq.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X_im167V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y35829t927sf8l9g8xsq.JPG" alt="Image description" width="880" height="275"&gt;&lt;/a&gt;&lt;br&gt;
A Subject is a special type of observable and is also an observer. Figure 1.0 demonstrates how to use the partition() function with a Subject, where the first parameter takes an observable (in this case, a Subject) and processes the emitted values from that observable based on the second parameter. The second parameter takes a condition that will be used to separate the values that pass said condition vs the values that fail the condition. In turn, two streams are returned and can be used for much cleaner mitigations and better code readability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
There are many ways to separate and handle logic of Observables' emitted values, such as pipe operators and if-else statements in the .subscribe() block. However, we've found that using partition() is a cleaner, more readable approach that avoids lengthy conditional logic inside your subscribe functions.  Reach out to us with any questions. &lt;/p&gt;

&lt;p&gt;We hope you enjoyed this article and encourage you to try it out on your next project. Happy coding!&lt;/p&gt;




&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@soymeraki?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Javier Allegue Barros&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
