<?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: Akash Gupta</title>
    <description>The latest articles on DEV Community by Akash Gupta (@akash_gupta).</description>
    <link>https://dev.to/akash_gupta</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%2F258922%2F331243cc-0019-4952-bd92-53e65d8e4a83.jpeg</url>
      <title>DEV Community: Akash Gupta</title>
      <link>https://dev.to/akash_gupta</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/akash_gupta"/>
    <language>en</language>
    <item>
      <title>How to Use React Router Dom as Pro</title>
      <dc:creator>Akash Gupta</dc:creator>
      <pubDate>Wed, 22 Sep 2021 05:27:31 +0000</pubDate>
      <link>https://dev.to/akash_gupta/how-to-use-react-router-dom-as-pro-2bi4</link>
      <guid>https://dev.to/akash_gupta/how-to-use-react-router-dom-as-pro-2bi4</guid>
      <description>&lt;p&gt;&lt;strong&gt;Routing&lt;/strong&gt; is super important part of any &lt;strong&gt;SPA&lt;/strong&gt;, without it you can’t navigate to another page.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Are you really managing it in a Best way?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s suppose, &lt;strong&gt;we have more than 100 pages in React&lt;/strong&gt; and have routing of each pages and &lt;strong&gt;one page may have linked to another page&lt;/strong&gt;. &lt;strong&gt;we will write something like this&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2472%2F1%2AtF0lFkLDSmfPXTAsIDn3qg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2472%2F1%2AtF0lFkLDSmfPXTAsIDn3qg.png" alt="React Bad Routing Style"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and have linking like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2188%2F1%2A-Q10uC0tX7BIyntXY8e8sg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2188%2F1%2A-Q10uC0tX7BIyntXY8e8sg.png" alt="React Bad linking"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;if we are managing it like above so the project code will gonna lose its cleanliness and richness very soon.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  So what’s the best way to manage it?
&lt;/h2&gt;

&lt;p&gt;*&lt;em&gt;Define all Routes inside *&lt;/em&gt;&lt;em&gt;routing/AppRoutes.ts&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Akyc1GyyUQPF7pdu8ljaX6g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Akyc1GyyUQPF7pdu8ljaX6g.png" alt="*AppRoutes*.ts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use **AppRoutes **like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2364%2F1%2AXUhEVGJXGr9DmTaOU6ftvg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2364%2F1%2AXUhEVGJXGr9DmTaOU6ftvg.png" alt="Good Routing Style"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;To make it more global and readable, create *&lt;/em&gt;*routing/*useAppRoutes.ts&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2096%2F1%2AugH_rzK0M3BNMKhkU2kJNw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2096%2F1%2AugH_rzK0M3BNMKhkU2kJNw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;now we need pass Param &lt;strong&gt;taskId&lt;/strong&gt; in &lt;strong&gt;TASK_DETAIL. **there can be easier way like this below but **i will not recommend it&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2372%2F1%2Ayo5jfqhBXAka4B0opDZGpQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2372%2F1%2Ayo5jfqhBXAka4B0opDZGpQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s make it more cleaner by overriding useHistory hook
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;npm i urlcat — save&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;routing*/useMyHistory.ts*&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2792%2F1%2AetrWIdOgQ2TuM6S72YKwRg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2792%2F1%2AetrWIdOgQ2TuM6S72YKwRg.png" alt="useMyHistory.ts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Finally we made it now it’s time to use it on our code.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Goto routing/&lt;em&gt;useAppRoutes.ts *&lt;/em&gt;&lt;em&gt;replace useHistory with useMyHistory&lt;/em&gt;*&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2076%2F1%2AaXGO3GKzYGwiwOniIfZ_mQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2076%2F1%2AaXGO3GKzYGwiwOniIfZ_mQ.png" alt="replacement of useHistory with useMyHistory"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Page Look Now&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2144%2F1%2AQi0PeL8PBGw5lnQHkOkffA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2144%2F1%2AQi0PeL8PBGw5lnQHkOkffA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is &lt;a href="https://github.com/akash-gupt/akash-superspace/tree/main/apps/react-routing-example" rel="noopener noreferrer"&gt;**Git Example&lt;/a&gt; .**&lt;/p&gt;

&lt;p&gt;Thanks for reading, I hope this gives you an idea of how to handle React Routing in cleaned and global way. Claps and shares are very much appreciated!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you enjoyed reading this, you may also enjoy some of my other blogs:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/@supereme_dev/react-native-how-i-followed-create-once-use-many-times-f9bb36d2788f" rel="noopener noreferrer"&gt;React Native Best way to keep clean code&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/@supereme_dev/generate-svg-icons-for-react-js-typescript-5429e283bf73" rel="noopener noreferrer"&gt;Generate SVG icons for React.Js Typescript&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Generate SVG icons for React.Js Typescript</title>
      <dc:creator>Akash Gupta</dc:creator>
      <pubDate>Wed, 22 Sep 2021 05:13:04 +0000</pubDate>
      <link>https://dev.to/akash_gupta/generate-svg-icons-for-react-js-typescript-6oi</link>
      <guid>https://dev.to/akash_gupta/generate-svg-icons-for-react-js-typescript-6oi</guid>
      <description>&lt;h2&gt;
  
  
  Generate SVG icons for React.Js Typescript
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yUk9irgX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3840/1%2AOWJzMqWPCoOmFhnCtbjfxQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yUk9irgX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3840/1%2AOWJzMqWPCoOmFhnCtbjfxQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was keep looking for a library that can generate typescript icons but i didn’t get success so i decided to make a library myself.&lt;/p&gt;

&lt;p&gt;Generate React Icon Component from SVG icons to show, resize and recolor them. The default template is a typescript template.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev react-svg-icon-generator-v2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Setup a node file
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Default mode
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const generator = require('react-svg-icon-generator-v2');
const config = {
    svgDir: './src/ui/icons/',
    destination: './src/components/ui/Icon.tsx'
};
generator(config);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Split mode
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const generator = require('react-svg-icon-generator-v2');
const config = {
    svgDir: './src/ui/icons/',
    mode: 'split',
    destination: './src/components/ui/Icon.tsx',
    iconDestination: './src/components/ui/icons/'
};
generator(config);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;svgDir&lt;/strong&gt; (required) - path to your directory with svg files. Can be relative path but it is better to use path.join(__dirname, 'icons') absolute path so it will work in any directory of project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;destination&lt;/strong&gt; (required) - path.join(__dirname, 'components', 'Icon.js')&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;mode&lt;/strong&gt; (optional) (single or split) - choose mode for generating icons. default mode is generate icons to one file. split is mode for generating each icon to react component&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;comment&lt;/strong&gt; (optional) - it will be added to generated component, so other developer will know what to do&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;template&lt;/strong&gt; (optional) - provide path to your custom template, you can look at example at &lt;a href="https://github.com/akash-gupt/react-svg-icon-generator-2/blob/HEAD/template/icon.nunjucks"&gt;Icon.template&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;iconTemplate&lt;/strong&gt; (optional) - provide path to your custom template for each icon, you can look at example at &lt;a href="https://github.com/akash-gupt/react-svg-icon-generator-2/blob/HEAD/template/split-icon.nunjucks"&gt;Icon.template&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H4X9W0Jq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AP9kj43zMXdxMGoOF3bFOdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H4X9W0Jq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AP9kj43zMXdxMGoOF3bFOdw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Use generate Icon component
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, {Component} from 'react';
import AppIcon from './AppIcon';

export default class App extends Component {
  render() {
    return (
      &amp;lt;div&amp;gt;
        Simple possible usage
        &amp;lt;AppIcon name='clock' /&amp;gt;

        Setup color and bounding width and height
        &amp;lt;AppIcon name='close' color='#748' width={500} height={100} /&amp;gt;

        Setup color and bounding width and height to size (square)
        &amp;lt;AppIcon name='close' color='red' size={600} /&amp;gt;

        Setup onClick behavior
        &amp;lt;AppIcon name='close' onClick={() =&amp;gt; alert('clicked on icon')} /&amp;gt;

        Show all icons at once with description (for finding right icon)
        &amp;lt;AppIcon preview /&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can find example here &lt;a href="https://github.com/akash-gupt/react-svg-icon-generator-2"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Generate SVG icons for React.Js Typescript</title>
      <dc:creator>Akash Gupta</dc:creator>
      <pubDate>Fri, 30 Jul 2021 15:09:58 +0000</pubDate>
      <link>https://dev.to/akash_gupta/generate-svg-icons-for-react-js-typescript-2k9n</link>
      <guid>https://dev.to/akash_gupta/generate-svg-icons-for-react-js-typescript-2k9n</guid>
      <description>&lt;h2&gt;
  
  
  Generate SVG icons for React.Js Typescript
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yUk9irgX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3840/1%2AOWJzMqWPCoOmFhnCtbjfxQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yUk9irgX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3840/1%2AOWJzMqWPCoOmFhnCtbjfxQ.png" alt="banner"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was keep looking for a library that can generate typescript icons but i didn’t get success so i decided to make a library myself.&lt;/p&gt;

&lt;p&gt;Generate React Icon Component from SVG icons to show, resize and recolor them. The default template is a typescript template.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev react-svg-icon-generator-v2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Setup a node file
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Default mode
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const generator = require('react-svg-icon-generator-v2');
const config = {
    svgDir: './src/ui/icons/',
    destination: './src/components/ui/Icon.tsx'
};
generator(config);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Split mode
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const generator = require('react-svg-icon-generator-v2');
const config = {
    svgDir: './src/ui/icons/',
    mode: 'split',
    destination: './src/components/ui/Icon.tsx',
    iconDestination: './src/components/ui/icons/'
};
generator(config);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;svgDir&lt;/strong&gt; (required) - path to your directory with svg files. Can be relative path but it is better to use path.join(__dirname, 'icons') absolute path so it will work in any directory of project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;destination&lt;/strong&gt; (required) - path.join(__dirname, 'components', 'Icon.js')&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;mode&lt;/strong&gt; (optional) (single or split) - choose mode for generating icons. default mode is generate icons to one file. split is mode for generating each icon to react component&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;comment&lt;/strong&gt; (optional) - it will be added to generated component, so other developer will know what to do&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;template&lt;/strong&gt; (optional) - provide path to your custom template, you can look at example at &lt;a href="https://github.com/akash-gupt/react-svg-icon-generator-2/blob/HEAD/template/icon.nunjucks"&gt;Icon.template&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;iconTemplate&lt;/strong&gt; (optional) - provide path to your custom template for each icon, you can look at example at &lt;a href="https://github.com/akash-gupt/react-svg-icon-generator-2/blob/HEAD/template/split-icon.nunjucks"&gt;Icon.template&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H4X9W0Jq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AP9kj43zMXdxMGoOF3bFOdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H4X9W0Jq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AP9kj43zMXdxMGoOF3bFOdw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Use generate Icon component
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, {Component} from 'react';
import AppIcon from './AppIcon';

export default class App extends Component {
  render() {
    return (
      &amp;lt;div&amp;gt;
        Simple possible usage
        &amp;lt;AppIcon name='clock' /&amp;gt;

        Setup color and bounding width and height
        &amp;lt;AppIcon name='close' color='#748' width={500} height={100} /&amp;gt;

        Setup color and bounding width and height to size (square)
        &amp;lt;AppIcon name='close' color='red' size={600} /&amp;gt;

        Setup onClick behavior
        &amp;lt;AppIcon name='close' onClick={() =&amp;gt; alert('clicked on icon')} /&amp;gt;

        Show all icons at once with description (for finding right icon)
        &amp;lt;AppIcon preview /&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can find example here &lt;a href="https://github.com/akash-gupt/react-svg-icon-generator-2"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>React Native: How i followed "create once use many times"</title>
      <dc:creator>Akash Gupta</dc:creator>
      <pubDate>Fri, 30 Jul 2021 15:05:10 +0000</pubDate>
      <link>https://dev.to/akash_gupta/react-native-how-i-followed-create-once-use-many-times-33mo</link>
      <guid>https://dev.to/akash_gupta/react-native-how-i-followed-create-once-use-many-times-33mo</guid>
      <description>&lt;p&gt;My client hired me for saving his life from messy code so i started refactoring the code by converting them into reusable and smaller components that can be follow create once use many times.&lt;/p&gt;

&lt;p&gt;Refactoring someone else code can be tough but i tried and successfully refactored whole code of more than 100 screens.&lt;br&gt;
I tried so many libraries to achieve a theming system according to client requirement but every other library have own problem and less support for resolving issues so i started setup my own thing.&lt;/p&gt;

&lt;p&gt;My First component was a Container which can be used everywhere and for every need. Believe me it saved me from boilerplate.&lt;/p&gt;

&lt;p&gt;For ex: we have 4 Text component and i wanted to make space between them is 5. how we normally do like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.tolink"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZbYUvBZx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1400/1%2A9bUpVzPAacyE749d42Ch9w.png" alt="unpotimized-code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make it in a Row&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.tolink"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rcIrBbIg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1400/1%2AQyBSrtU5HdjkgD-0D-Bjrw.png" alt="unpotimized-code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Don't you think it is getting start messy.&lt;br&gt;
Check My Version, it is clean right 😁&lt;/p&gt;

&lt;p&gt;Let's start baking it&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We have not finished yet, now it's time to create Container&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;p - padding
m - margin
x - horizontal
y - vertical
l - left
r - right
pr - padding right
pl - padding left
px - padding horizontal
py - padding vertical
pxy - padding all
mr - margin right
ml - margin left
mx - margin horizontal
my - margin vertical
mxy - margin all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spaceBetween - space between components
hidden - hide component based on condition
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;😁😁😁😁😁 We just saved so much boilerplate.&lt;br&gt;
Happy Coding&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/@supereme_dev/react-native-how-i-followed-create-once-use-many-times-f9bb36d2788f" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lq7mKhWu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/fit/c/56/56/1%2AOtVH8Y7S_jr_q6RcIBImkw.jpeg" alt="Akash Gupta"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/@supereme_dev/react-native-how-i-followed-create-once-use-many-times-f9bb36d2788f" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;React Native: How i followed “create once use many times” | by Akash Gupta | Jul, 2021 | Medium&lt;/h2&gt;
      &lt;h3&gt;Akash Gupta ・ &lt;time&gt;Jul 29, 2021&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ze5yh_2q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/medium_icon-90d5232a5da2369849f285fa499c8005e750a788fdbf34f5844d5f2201aae736.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



</description>
      <category>reactnative</category>
      <category>refactoring</category>
      <category>react</category>
      <category>reusable</category>
    </item>
  </channel>
</rss>
