<?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: Usaid</title>
    <description>The latest articles on DEV Community by Usaid (@usaidpeerzada).</description>
    <link>https://dev.to/usaidpeerzada</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%2F320066%2F22b9d608-c952-4c20-bdcd-4c7ab3bff990.png</url>
      <title>DEV Community: Usaid</title>
      <link>https://dev.to/usaidpeerzada</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/usaidpeerzada"/>
    <language>en</language>
    <item>
      <title>Generics in TypeScript</title>
      <dc:creator>Usaid</dc:creator>
      <pubDate>Tue, 26 Dec 2023 19:37:54 +0000</pubDate>
      <link>https://dev.to/usaidpeerzada/generics-in-typescript-5c5e</link>
      <guid>https://dev.to/usaidpeerzada/generics-in-typescript-5c5e</guid>
      <description>&lt;p&gt;Generics in TypeScript allow you to write functions and classes that can work with a variety of data types while maintaining type safety. They provide a way to create reusable and type-safe components, offering a level of abstraction that promotes code flexibility.&lt;/p&gt;

&lt;p&gt;Let's start by looking at a simple example. Consider a function that returns the input it receives:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;returnValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;val&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;val&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numReturn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;returnValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;strReturn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;returnStr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While this works, it lacks type safety. The any type means that the function can accept any type of argument, but it doesn't provide information about the type of the returned value. This is where generics come into play.&lt;/p&gt;

&lt;p&gt;Generics allow us to create functions and classes that can work with different data types while preserving type information. Let's rewrite the returnValue function using generics:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;returnValue&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;val&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;val&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numReturn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;returnValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the T inside the angle brackets  represents a type parameter. The type parameter T acts as a placeholder for the actual type that will be provided when the function is called. In the case of returnValue(21), T is inferred to be number (If you pass a string it will be taken as a string).&lt;/p&gt;

&lt;p&gt;Benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Type Safety: With generics, you can write code that is both flexible and type-safe. The TypeScript compiler can catch type-related errors at compile time, providing a safety net that plain JavaScript lacks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Code Reusability: Generics allow you to create functions and classes that can work with different types without sacrificing reusability. This can lead to more modular and maintainable code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Functionality Abstraction: Generics enable the creation of highly abstracted and versatile components. You can write code that doesn't depend on specific types, making it adaptable to a wide range of scenarios.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improved Readability: By using generics, your code becomes more expressive and readable. Type parameters provide meaningful names for the types involved, making the code easier to understand.&lt;br&gt;
Conclusion:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this introductory guide, we've explored the basics of generics in TypeScript. As you delve deeper into TypeScript development, generics will become an essential tool in your toolkit for writing robust, reusable, and type-safe code. By leveraging generics, you can enhance the flexibility and maintainability of your TypeScript projects, making them more scalable and easier to work with in the long run.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Brief RSC (react server component) explanation</title>
      <dc:creator>Usaid</dc:creator>
      <pubDate>Sun, 12 Mar 2023 16:15:33 +0000</pubDate>
      <link>https://dev.to/usaidpeerzada/brief-react-server-component-explanation-3ogg</link>
      <guid>https://dev.to/usaidpeerzada/brief-react-server-component-explanation-3ogg</guid>
      <description>&lt;h3&gt;
  
  
  Everybody is talking about RSC these days so I thought I'd make a brief introduction explaining what react server components are.
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Server components&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;They don’t need client side state and interactions. Essentially the server uses data to generate the relevant HTML and returns it to the browser. Inside the server components you can use interactive client components. The server components HTML may be generated from data already on the server. For example, from an API call to your database.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Client components&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;These are interactive JSX components (I.e. clicking on buttons and interacting with the state data). Basically HTML created at runtime in the browser from JavaScript.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;What RSC does?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;RSC incrementally streams the content of the web app from server to the browser. When the user loads the website, the browser sends a request to the server, the server fetches data from the backend and whatever data it gets it starts to paint the browser window with it. What I mean by this is that unlike SSR, RSC does not wait till we get all the data from the backend, it renders parts of the page such as the NavBar, Footer or some text, this streaming is achieved by serialising the react component into JSON data on server side and then reconstructing it the browser. &lt;br&gt;
The server components also have automatic bundle splitting meaning that you would not require dynamic imports and if a page does not use a component it will not be sent to it.  &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Problems and how RSC solves them&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;There are many problems that RSC solves but two of them are important and worth knowing.&lt;/p&gt;

&lt;p&gt;1) Waterfalls in fetching data&lt;br&gt;
Waterfalls occur when data takes a long time to load, slowing down your applications. There can be many potential areas for waterfalls to occur, but one of the most common ones is on requests from the client to the server (and the server sending its response to the client). This back and forth communication between the server and client can cause significant latency and noticeably slow down your app, particularly if you have sequential requests coming from parent and child components. React server components solves this problem by fetching data on the server, eliminating that latency.&lt;/p&gt;

&lt;p&gt;2) Large bundle sizes&lt;br&gt;
When the browser is downloading huge amounts data in large web apps especially in SSR apps, it can take a while to load the page, especially over slower connections. React server components help solve this problem by sending only required code to the browser.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Resources to learn more about RSCs&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Here's a demo code link from the react team:
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/reactjs"&gt;
        reactjs
      &lt;/a&gt; / &lt;a href="https://github.com/reactjs/server-components-demo"&gt;
        server-components-demo
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Demo app of React Server Components.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
React Server Components Demo&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#what-is-this"&gt;What is this?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#when-will-i-be-able-to-use-this"&gt;When will I be able to use this?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#should-i-use-this-demo-for-benchmarks"&gt;Should I use this demo for benchmarks?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#setup"&gt;Setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/reactjs/server-components-demo#db-setup"&gt;DB Setup&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#step-1-create-the-database"&gt;Step 1. Create the Database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#step-2-connect-to-the-database"&gt;Step 2. Connect to the Database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#step-3-run-the-seed-script"&gt;Step 3. Run the seed script&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/reactjs/server-components-demo#notes-about-this-app"&gt;Notes about this app&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#interesting-things-to-try"&gt;Interesting things to try&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#built-by-a-z"&gt;Built by (A-Z)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#code-of-conduct"&gt;Code of Conduct&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/reactjs/server-components-demo#license"&gt;License&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;This is a demo app built with Server Components, an experimental React feature. &lt;strong&gt;We strongly recommend &lt;a href="https://reactjs.org/server-components" rel="nofollow"&gt;watching our talk introducing Server Components&lt;/a&gt; before exploring this demo.&lt;/strong&gt; The talk includes a walkthrough of the demo code and highlights key points of how Server Components work and what features they provide.&lt;/p&gt;

&lt;h2&gt;
When will I be able to use this?&lt;/h2&gt;

&lt;p&gt;Server Components are an experimental feature and &lt;strong&gt;are not ready for adoption&lt;/strong&gt;. For now, we recommend experimenting with Server Components via this demo app. &lt;strong&gt;Use this in your projects at your own&lt;/strong&gt;…&lt;/p&gt;
&lt;/div&gt;


&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/reactjs/server-components-demo"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=TQQPAU21ZUw"&gt;Data fetching with RSC&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Adding a button with onclick on InfoWindow - Google Maps API</title>
      <dc:creator>Usaid</dc:creator>
      <pubDate>Mon, 20 Sep 2021 18:58:18 +0000</pubDate>
      <link>https://dev.to/usaidpeerzada/adding-a-button-with-onclick-on-infowindow-google-maps-api-1ne6</link>
      <guid>https://dev.to/usaidpeerzada/adding-a-button-with-onclick-on-infowindow-google-maps-api-1ne6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;InfoWindow in google maps is a type of toast div or should I say a popover that appears when we hover over the map marker, it contains information about a specific place anything you want to show in it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Let me show you the easiest way to add a button with onclick function inside the infoWindow content string if nothing else is working or if you are trying to click on the button before the DOM is ready.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Content String&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let buttonName = "any name"; 
let contentString = "&amp;lt;div&amp;gt;" +
                     // other divs ....
                      "&amp;lt;button id='btn-click'&amp;gt;" + buttonName                       
                       + "&amp;lt;/button&amp;gt;" 
                     // other divs ....
                    +"&amp;lt;/div&amp;gt;";

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Adding click event on your function:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;google.maps.event.addListener(infoWindow, 'domready' () =&amp;gt; {
 const someButton = document.getElementById('btn-click');
 if (someButton) {
   google.maps.listener.addDomListener(someButton, 'click',    
   () =&amp;gt; {
           // show something.
           // add something.
         })
 }
});

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Marker Code:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;google.maps.event.addListener(marker, 'mouseover', function(){
 // some code about setting content inside info window or showing up the info window however you want to show it.
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  That's it, let me know if it worked :).
&lt;/h5&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>googlemaps</category>
    </item>
    <item>
      <title>Showing an offline screen for your React-Native app using NetInfo package.</title>
      <dc:creator>Usaid</dc:creator>
      <pubDate>Fri, 16 Jul 2021 09:45:47 +0000</pubDate>
      <link>https://dev.to/usaidpeerzada/showing-an-offline-screen-for-your-react-native-app-using-netinfo-package-2dn6</link>
      <guid>https://dev.to/usaidpeerzada/showing-an-offline-screen-for-your-react-native-app-using-netinfo-package-2dn6</guid>
      <description>&lt;p&gt;So you want to check internet connection and show an offline screen if you are disconnected?&lt;/p&gt;

&lt;p&gt;Here are simple steps to create one:&lt;/p&gt;

&lt;p&gt;1) Install &lt;strong&gt;netinfo&lt;/strong&gt; package from npm: &lt;br&gt;
   &lt;code&gt;npm install --save @react-native-community/netinfo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2) Import it in your js file wherever you want it to be, declare a variable and set it's value to null:&lt;br&gt;
&lt;code&gt;let NetInfoSubscription = null;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3) Initialize a state and set the default value to false:&lt;br&gt;
&lt;code&gt;const [connectionStatus, setConnectionStatus] = useState(false);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;4) Create a function that changes the value of the &lt;strong&gt;connectionStatus&lt;/strong&gt; based on if the internet is connected or not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleConnectionChange = (state) =&amp;gt; {
    setConnectionStatus(state.isConnected);
  }; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5) Inside useEffect hook reassign the value of &lt;strong&gt;NetInfoSubscription&lt;/strong&gt; and add this piece of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NetInfoSubscription = NetInfo.addEventListener(handleConnectionChange);
    return () =&amp;gt; {
      NetInfoSubscription;
    };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6) Now just use a ternary operator to show the main contents if the connection is there or show the offline screen if the connection is disconnected.&lt;br&gt;
example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connectionStatus ? &amp;lt;MainContent /&amp;gt; : &amp;lt;OfflineScreen /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is it now if the internet is disconnected offline screen will be rendered.&lt;/p&gt;

&lt;p&gt;Let me know if you have some questions or want to see how I created my Offline Screen :)&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>android</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Hosting your react-native express.js backend on Heroku.</title>
      <dc:creator>Usaid</dc:creator>
      <pubDate>Wed, 19 May 2021 11:38:40 +0000</pubDate>
      <link>https://dev.to/usaidpeerzada/hosting-your-react-native-express-js-backend-on-heroku-5b3l</link>
      <guid>https://dev.to/usaidpeerzada/hosting-your-react-native-express-js-backend-on-heroku-5b3l</guid>
      <description>&lt;p&gt;You have created an app in react native and written backend in expressjs/nodejs and you want to host your backend so you can get or post data on your app from anywhere?&lt;/p&gt;

&lt;p&gt;Answer: Heroku.&lt;/p&gt;

&lt;p&gt;Here's how:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a Heroku account on &lt;a href="http://www.heroku.com"&gt;www.heroku.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install Heroku CLI.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// for mac:
brew tap heroku/brew &amp;amp;&amp;amp; brew install heroku
// for ubuntu: 
sudo snap install --classic heroku

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;After Heroku CLI has been installed, open the terminal and just login with your credentials
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
// type this in your terminal to login:
heroku login

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;When you have logged in you can create a heroku app by executing this command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
heroku create

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Once the heroku app has been created you will see the app name, remote git link and the site url.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add heroku remote branch:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku git:remote -a your-app-name

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Heroku git remote will be added and you can check that by:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
git remote -v

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add Procfile to the root of your backend folder, eg:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-ReactNativeAppFolder
 -MainBackendFolder 
  -routesFolder
    -Routes.js
  -modelsFolder
    -Schema.js
  -app.js
  -package.json
  -package-lock.json
  -Procfile

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Procfile is needed to tell heroku to run node app.js on it's server, so your app can start and run.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You don't need to push the whole react-native app to heroku you can just push your backend folder to it, here's how:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
git subtree push --prefix MainBackendFolder heroku master

// this specific command makes sure that only backend folder gets pushed to heroku.

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After the build and push is successful heroku will tell you that your app is being hosted on a specific url.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can then add the specific url however you want to on your get and post request urls. That is it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>reactnative</category>
      <category>node</category>
      <category>heroku</category>
    </item>
    <item>
      <title>Simple way to get react-native local push notifications to work (android).</title>
      <dc:creator>Usaid</dc:creator>
      <pubDate>Sat, 15 May 2021 21:04:11 +0000</pubDate>
      <link>https://dev.to/usaidpeerzada/simple-way-to-get-react-native-local-push-notifications-to-work-android-5b8d</link>
      <guid>https://dev.to/usaidpeerzada/simple-way-to-get-react-native-local-push-notifications-to-work-android-5b8d</guid>
      <description>&lt;p&gt;Do you want to get local push notifications to work? Here's simple steps that might help you:&lt;/p&gt;

&lt;p&gt;1) Create a file name it anything you want I named it "AndroidNotificationHandler.js".&lt;/p&gt;

&lt;p&gt;2) Import react-native push-notification package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import PushNotification, {Importance} from 'react-native-push-notification';

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

&lt;/div&gt;



&lt;p&gt;3) Since latest update push-notification package requires you to create a channel id in order for notifications to work properly, here's what it looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const createChannel = () =&amp;gt; {
  PushNotification.createChannel(
    {
      channelId: 'channel-id', // (required)
      channelName: 'My channel', // (required)
      channelDescription: 'A channel to categorise your notifications', // (optional) default: undefined.
      playSound: false, // (optional) default: true
      soundName: 'default', // (optional) See `soundName` parameter of `localNotification` function
      importance: Importance.HIGH, // (optional) default: Importance.HIGH. Int value of the Android notification importance
      vibrate: true, // (optional) default: true. Creates the default vibration patten if true.
    },
    (created) =&amp;gt; console.log(`createChannel returned '${created}'`), // (optional) callback returns whether the channel was created, false means it already existed.
  );
};

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

&lt;/div&gt;



&lt;p&gt;4) After you have created the channelId function create another function that will do the main work in order to get the notifications that you want it to get. Check this out:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const notificationHandler = (title, message, date) =&amp;gt; {
  PushNotification.localNotificationSchedule({
    channelId: 'channel-id', // this we get from above func()
    title: title,
    message: message,
    autoCancel: true,
    subText: 'Notification',
    vibrate: true,
    vibration: 300,
    playSound: true,
    soundName: 'default',
    ignoreInForeground: false,
    importance: 'high',
    invokeApp: true,
    allowWhileIdle: true,
    priority: 'high',
    visibility: 'public',
    date: date,
  });
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5) You can also cancel notifications if you want, here's how:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const cancelNotifications = () =&amp;gt; {
  PushNotification.cancelAllLocalNotifications();
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6) export your functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export {createChannel, notificationHandler, cancelNotifications};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7) You can now import use these functions across your project, example from my project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let alertDescription = `Time to study ${topicName}`;
notificationHandler('Reminder!', alertDescription, date);
// I get date parameter from datepicker.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is it. You shall get your notifications now :).&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>react</category>
      <category>android</category>
    </item>
    <item>
      <title>My experience with imposter syndrome as a beginner / junior developer.</title>
      <dc:creator>Usaid</dc:creator>
      <pubDate>Sun, 21 Mar 2021 13:53:49 +0000</pubDate>
      <link>https://dev.to/usaidpeerzada/my-experience-with-imposter-syndrome-as-a-beginner-junior-developer-11ec</link>
      <guid>https://dev.to/usaidpeerzada/my-experience-with-imposter-syndrome-as-a-beginner-junior-developer-11ec</guid>
      <description>&lt;h5&gt;
  
  
  I wanted to share my experience and talk about this huge emotional phase that we all as beginners and junior developers go through at the start of our dev careers.
&lt;/h5&gt;

&lt;p&gt;Let me first briefly tell you about my path towards being a developer.&lt;/p&gt;

&lt;p&gt;I finished my CSE degree in September 2019 and after that I didn’t know what to do there were many career paths that I was trying to consider but first I thought I would take a break and “Chill” for a while, this “Chill” phase lasted till December 27th 2019 when I decided to so something with my life and take a path either as a developer or may be something else. So I decided that I was going to teach myself web development, I browsed through &lt;strong&gt;Udemy&lt;/strong&gt; and found a course taught by London App Brewery named as &lt;strong&gt;The Complete 2020 Web Development Bootcamp&lt;/strong&gt;, that taught about &lt;strong&gt;MERN&lt;/strong&gt; stack, I purchased the course and made a study plan which I would execute everyday till the bootcamp was completed. After completing the bootcamp I started practicing Javascript on codewars and studied more about ReactJs which I had come across in the bootcamp. I felt confident with my skills and started applying for jobs, gave a couple of interviews and got rejected until finally in August 2020 I got my first job as a web developer at a startup. &lt;br&gt;
At this point I thought that  I had clear concepts and could work with ease but when I started working I quickly noticed how less I know and how much is still there to learn. I went from “I can do it” to “I don’t know if I’m fit for coding” in about a month and a half, I felt like I don't know anything and I don't think i'll make it, I was taking time to finish tasks and understanding new concepts and then I realised that I’m just a fresher, just a beginner with not even a month of real experience and that I was expecting too much from myself, I used to see senior developers and other developers finishing a task in lesser time than me and that drove me crazy. So I started searching on google about &lt;strong&gt;Imposter Syndrome&lt;/strong&gt; and how to deal with it. I have read a fair share of blogs written over this topic and finally came to a conclusion that hey, it happens to all of us, even the senior developers feel it sometimes and that helped me a lot.&lt;br&gt;
I know we all feel it and for the beginners who are reading this, you are gonna get this feeling sometime, everybody does, what you can do is to just take a day at a time, focus on getting better at your concepts and practice, you see, your company that hired you already knows that you are a beginner and they don't expect you to finish tasks or solve complex problems in a small period of time, what you can do is to just try your best and never give up on yourself. Don't ever think that you won’t be able to make it or you should quit cause you are not alone there’s a million other developers who feel the same way, just focus on getting better, take micro steps and with time you will overcome this huge fear of not being a “good developer”. &lt;br&gt;
You just need to believe in yourself and never give up.&lt;/p&gt;

&lt;p&gt;I would love to hear your experiences in the discussions below.&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@chrisyangchrisfilm?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Chris Yang&lt;/a&gt; on &lt;a href="/s/photos/imposter?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mentalhealth</category>
      <category>career</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Simple way to use dev.to article API to show your articles on your portfolio website.</title>
      <dc:creator>Usaid</dc:creator>
      <pubDate>Sat, 20 Mar 2021 18:01:18 +0000</pubDate>
      <link>https://dev.to/usaidpeerzada/simple-way-to-use-dev-to-article-api-to-show-your-articles-on-your-portfolio-website-g5f</link>
      <guid>https://dev.to/usaidpeerzada/simple-way-to-use-dev-to-article-api-to-show-your-articles-on-your-portfolio-website-g5f</guid>
      <description>&lt;p&gt;Do you want to set your dev.to articles to appear on your portfolio website? &lt;br&gt;
Let me show you how I used the article API to get my dev.to posts on my portfolio website in just two steps.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Just add your username at the end of this API-link: "&lt;a href="https://dev.to/api/articles?username=yourUserName"&gt;https://dev.to/api/articles?username=yourUserName&lt;/a&gt;"&lt;/li&gt;
&lt;li&gt;Use axios to get your posts and then render it on the frontend.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;simple example:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;const getDevToPosts = () =&amp;gt; {&lt;br&gt;
    axios&lt;br&gt;
      .get("https://dev.to/api/articles?username=usaidpeerzada")&lt;br&gt;
      .then((res) =&amp;gt; {&lt;br&gt;
        setBlogState(res.data);&lt;br&gt;
      });&lt;br&gt;
  };&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>website not running on express(), need help.</title>
      <dc:creator>Usaid</dc:creator>
      <pubDate>Sat, 07 Mar 2020 16:31:08 +0000</pubDate>
      <link>https://dev.to/usaidpeerzada/website-not-running-on-express-need-help-10oj</link>
      <guid>https://dev.to/usaidpeerzada/website-not-running-on-express-need-help-10oj</guid>
      <description>&lt;p&gt;Trying to run website on express server but it fails to get the styles and only shows the html file, i have included the stylesheet inside the html file, any ideas why ?&lt;/p&gt;

</description>
      <category>help</category>
      <category>node</category>
      <category>express</category>
    </item>
  </channel>
</rss>
