<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Shubham's Blog]]></title><description><![CDATA[Shubham is a Frontend focused Fullstack (MERN) developer. He is proficient in working with React + Redux along with other UI libraries.

He has more than 2 year]]></description><link>https://blog.shubhamprakash.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 05:04:52 GMT</lastBuildDate><atom:link href="https://blog.shubhamprakash.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Setting up a TypeScript Express Server with Prettier and ESLint]]></title><description><![CDATA[Here is a quick tutorial on how to set up a TypeScript express server with ESLint and Prettier.
Prerequisites
Please make sure you have the following installed in your local development environment:

Node.js version >= 14.x.x installed
Access to one ...]]></description><link>https://blog.shubhamprakash.dev/setting-up-a-typescript-express-server-with-prettier-and-eslint</link><guid isPermaLink="true">https://blog.shubhamprakash.dev/setting-up-a-typescript-express-server-with-prettier-and-eslint</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[eslint]]></category><category><![CDATA[Express]]></category><dc:creator><![CDATA[Shubham Prakash]]></dc:creator><pubDate>Thu, 09 Sep 2021 17:59:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631211716240/u7EyFq_sM.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Here is a quick tutorial on how to set up a TypeScript express server with ESLint and Prettier.</p>
<p><strong>Prerequisites</strong></p>
<p>Please make sure you have the following installed in your local development environment:</p>
<ul>
<li>Node.js version &gt;= 14.x.x installed</li>
<li>Access to one package manager such as <code>npm</code> or <code>yarn</code></li>
</ul>
<p><strong>1. Creating project directory</strong></p>
<p>Create a project folder and use npm’s initializer command to create a <code>package.json</code> file:</p>
<pre><code class="lang-bash">$ mkdir server
$ <span class="hljs-built_in">cd</span> server
$ npm init --yes
</code></pre>
<p>The <code>--yes</code> flag uses the default settings when initializing a <code>package.json</code> from the npm config you might have set up.</p>
<p>The <code>package.json</code> file created might look something like this:</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"name"</span>: <span class="hljs-string">"server"</span>,
  <span class="hljs-attr">"version"</span>: <span class="hljs-string">"1.0.0"</span>,
  <span class="hljs-attr">"description"</span>: <span class="hljs-string">""</span>,
  <span class="hljs-attr">"main"</span>: <span class="hljs-string">"index.js"</span>,
  <span class="hljs-attr">"scripts"</span>: {
    <span class="hljs-attr">"test"</span>: <span class="hljs-string">"echo \"Error: no test specified\" &amp;&amp; exit 1"</span>
  },
  <span class="hljs-attr">"keywords"</span>: [],
  <span class="hljs-attr">"author"</span>: <span class="hljs-string">""</span>,
  <span class="hljs-attr">"license"</span>: <span class="hljs-string">"ISC"</span>
}
</code></pre>
<p><strong>2. Adding packages and config</strong></p>
<p>We'll start by adding the following packages-</p>
<blockquote>
<p>Dependencies:</p>
</blockquote>
<ul>
<li><p><a target="_blank" href="https://www.npmjs.com/package/express">express</a>: Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications APIs.</p>
</li>
<li><p><a target="_blank" href="https://www.npmjs.com/package/dotenv">dotenv</a>: It is a lightweight npm package that automatically loads environment variables from a . env file into the process. env object.</p>
</li>
</ul>
<blockquote>
<p>Dev Dependencies</p>
</blockquote>
<ul>
<li><p><a target="_blank" href="https://www.npmjs.com/package/typescript">typescript</a>: Helps us write code in typescript and compile all of our codebases into plain javascript.</p>
</li>
<li><p><a target="_blank" href="https://www.npmjs.com/package/ts-node">ts-node</a>: It helps us to run typescript code without precompiling to JS for faster development.</p>
</li>
<li><p><a target="_blank" href="https://www.npmjs.com/package/nodemon">nodemon</a>: It is a simple monitor script for use during the development of a node.js app. It allows us to automatically restart the server when we make any changes in our code.</p>
</li>
<li><p><a target="_blank" href="https://www.npmjs.com/package/@types/express">@types/express</a> : This package contains type definitions for Express</p>
</li>
</ul>
<p>We'll install more packages later but let's start with the above ones-</p>
<pre><code class="lang-bash">$ npm install express
$ npm install dotenv
$ npm install -D typescript
$ npm install -D ts-node
$ npm install -D nodemon
$ npm install -D @types/express
</code></pre>
<p><strong>Setting up <a target="_blank" href="https://www.typescriptlang.org/docs/handbook/tsconfig-json.html">TSConfig</a></strong></p>
<p>The presence of a <code>tsconfig.json</code> file in a directory indicates that the directory is the root of a TypeScript project. The <code>tsconfig.json</code> file specifies the root files and the compiler options required to compile the project.</p>
<p>Run the following command at the root of your project directory-</p>
<pre><code>$ tsc <span class="hljs-comment">--init</span>
</code></pre><p>This command will generate a <code>tsconfig.json</code> file at the root of your project directory. The JSON will have many fields with comments explaining what they are and what are the possible values for each field.</p>
<p>Please make sure you have the following fields uncommented out with the following values-</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"compilerOptions"</span>: {
    <span class="hljs-attr">"target"</span>: <span class="hljs-string">"es6"</span>,
    <span class="hljs-attr">"module"</span>: <span class="hljs-string">"commonjs"</span>,
    <span class="hljs-attr">"lib"</span>: [<span class="hljs-string">"es6"</span>, <span class="hljs-string">"dom"</span>],
    <span class="hljs-attr">"sourceMap"</span>: <span class="hljs-literal">true</span>,
    <span class="hljs-attr">"outDir"</span>: <span class="hljs-string">"dist"</span>,
    <span class="hljs-attr">"rootDir"</span>: <span class="hljs-string">"src"</span>,
    <span class="hljs-attr">"strict"</span>: <span class="hljs-literal">true</span>,
    <span class="hljs-attr">"moduleResolution"</span>: <span class="hljs-string">"node"</span>,
    <span class="hljs-attr">"esModuleInterop"</span>: <span class="hljs-literal">true</span>,
    <span class="hljs-attr">"skipLibCheck"</span>: <span class="hljs-literal">true</span>,
    <span class="hljs-attr">"forceConsistentCasingInFileNames"</span>: <span class="hljs-literal">true</span>
  },
  <span class="hljs-attr">"include"</span>: [<span class="hljs-string">"src/**/*.ts"</span>],
  <span class="hljs-attr">"exclude"</span>: [<span class="hljs-string">"node_modules"</span>]
}
</code></pre>
<p>You can learn more about these options <a target="_blank" href="https://www.typescriptlang.org/docs/handbook/compiler-options.html">here</a></p>
<p><strong>Setting up ESLint + Prettier for linting and code formatting-</strong></p>
<p>Installing ESLint:</p>
<pre><code>$ <span class="hljs-built_in">npm</span> install -D eslint
$ <span class="hljs-built_in">npm</span> install -D @typescript-eslint/parser
$ <span class="hljs-built_in">npm</span> install -D @typescript-eslint/eslint-plugin
$ <span class="hljs-built_in">npm</span> install -D eslint-config-airbnb-base
$ <span class="hljs-built_in">npm</span> install -D eslint-plugin-<span class="hljs-keyword">import</span>
</code></pre><p>Installing Prettier:</p>
<pre><code>$ npm <span class="hljs-keyword">install</span> -D prettier
$ npm <span class="hljs-keyword">install</span> -D  eslint-config-prettier
$ npm <span class="hljs-keyword">install</span> -D eslint-<span class="hljs-keyword">plugin</span>-prettier
</code></pre><p>Create a <code>.prettierrc.yml</code> file in your project directory-</p>
<pre><code class="lang-yaml"><span class="hljs-attr">tabWidth:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">singleQuote:</span> <span class="hljs-literal">true</span>
</code></pre>
<p>Next, create a <code>.eslintrc.yml</code> configuration file in your root folder to setup rules and parsing for the project-</p>
<pre><code class="lang-yaml"><span class="hljs-attr">env:</span>
  <span class="hljs-attr">es2021:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">node:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">extends:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">airbnb-base</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">plugin:@typescript-eslint/recommended</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">plugin:prettier/recommended</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">plugin:import/recommended</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">plugin:import/typescript</span>
<span class="hljs-attr">parser:</span> <span class="hljs-string">'@typescript-eslint/parser'</span>
<span class="hljs-attr">parserOptions:</span>
  <span class="hljs-attr">ecmaVersion:</span> <span class="hljs-number">12</span>
  <span class="hljs-attr">sourceType:</span> <span class="hljs-string">module</span>
  <span class="hljs-attr">project:</span> <span class="hljs-string">./tsconfig.json</span>
<span class="hljs-attr">plugins:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">'@typescript-eslint'</span>
<span class="hljs-attr">rules:</span>
  <span class="hljs-attr">no-console:</span> <span class="hljs-string">'off'</span>
  <span class="hljs-attr">import/extensions:</span> <span class="hljs-string">'never'</span>
</code></pre>
<p>Note that I have also addeded congigurations to integrate Prettier with ESLint, in the <code>.eslintrc.yaml</code></p>
<p>Now, let's create a folder <code>src</code> and a file <code>index.ts</code>-</p>
<pre><code class="lang-bash">$ mkdir src
$ <span class="hljs-built_in">cd</span> src
$ touch index.ts
</code></pre>
<p>Let's also add the following code, to begin with a minimal express server-</p>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> express <span class="hljs-keyword">from</span> <span class="hljs-string">'express'</span>;
<span class="hljs-keyword">const</span> app = express();
<span class="hljs-keyword">const</span> PORT = <span class="hljs-number">4000</span>;

app.get(<span class="hljs-string">'/'</span>, <span class="hljs-function">(<span class="hljs-params">req, res</span>) =&gt;</span> res.send(<span class="hljs-string">'Express + TypeScript Server'</span>));
app.listen(PORT, <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`⚡️[server]: Server is running at https://localhost:<span class="hljs-subst">${PORT}</span>`</span>);
});
</code></pre>
<p><strong>Adding a Start Script:</strong></p>
<p>Now, let's add some scripts to make it easier to run our code. Add the following to the <code>package.json</code> file.</p>
<pre><code class="lang-json">  <span class="hljs-string">"scripts"</span>: {
    <span class="hljs-attr">"start"</span>: <span class="hljs-string">"node dist/index.js"</span>,
    <span class="hljs-attr">"build"</span>: <span class="hljs-string">"tsc"</span>,
    <span class="hljs-attr">"dev"</span>: <span class="hljs-string">"nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts"</span>,
    <span class="hljs-attr">"lint"</span>: <span class="hljs-string">"eslint ."</span>,
    <span class="hljs-attr">"lint:fix"</span>: <span class="hljs-string">"eslint . --fix"</span>
  }
</code></pre>
<p>Now you should be able to start the server using the command <code>npm run dev</code> and test it in your browser.</p>
<p>Visiting <code>http://localhost:4000</code> in your browser should display <code>Express + TypeScript Server</code> text.</p>
<p><strong>Extra: VS code settings</strong>
I have installed some extensions and added the following setting to enable auto formatting on save etc-</p>
<p>Add a file <code>.vscode/setting.json</code> at the root of your project directory-</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"editor.tabSize"</span>: <span class="hljs-number">2</span>,
  <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"esbenp.prettier-vscode"</span>,
  <span class="hljs-attr">"editor.formatOnSave"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"editor.formatOnPaste"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"editor.formatOnType"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"eslint.alwaysShowStatus"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"files.autoSave"</span>: <span class="hljs-string">"onFocusChange"</span>,
  <span class="hljs-attr">"[javascript]"</span>: {
    <span class="hljs-attr">"editor.formatOnSave"</span>: <span class="hljs-literal">false</span>
  }
}
</code></pre>
<p>You'll also need to install the following extension-</p>
<ul>
<li><a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint">ESLint</a></li>
<li><a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode">Prettier - Code formatter</a></li>
</ul>
<p><strong>Credits</strong></p>
<ul>
<li>https://blog.logrocket.com/typescript-with-node-js-and-express/</li>
<li>https://dev.to/caelinsutch/setting-up-a-typescript-nodejs-application-with-prettier-and-eslint-53jc?signin=true</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[2020 Was An Amazing Year.]]></title><description><![CDATA[I know it sounds crazy to say considering the ongoing pandemic situation and so many unfortunate incidents, but this is true at least for me. This year was one of the most remarkable years of my life where I learned a lot of things not only career-re...]]></description><link>https://blog.shubhamprakash.dev/2020-was-an-amazing-year</link><guid isPermaLink="true">https://blog.shubhamprakash.dev/2020-was-an-amazing-year</guid><dc:creator><![CDATA[Shubham Prakash]]></dc:creator><pubDate>Thu, 31 Dec 2020 01:33:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1617394961465/3o4r52a7E.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I know it sounds crazy to say considering the ongoing pandemic situation and so many unfortunate incidents, but this is true at least for me. This year was one of the most remarkable years of my life where I learned a lot of things not only career-related but also about people and life in general. I actually grew as a person.</p>
<p>Today, the last day of 2020, I was looking back and thinking what/how/who changed, how I grew, and most importantly what I learned. A lot of good and some not so good things happened this year. I couldn't resist myself from writing this blog post and sharing it with you people. A lot of things started popping into my mind but I have tried summarising the important ones into bullet points so that I can compare them with my learnings at the end of next year.</p>
<ul>
<li><p><strong>Found my true passion:</strong> During my internship period at Scoar, I found myself working days-and nights continuously for around 1 month with just 4-5 hrs of sleep on an amazing project. At this time I realized that I don't just like doing FrontEnd but I have a passion for building beautiful User Interfaces that people love to use and play with. I figured out that I can do it all day and night without feeling bored or tired. React.js continued to be my favorite tool for converting the ideas into reality.</p>
</li>
<li><p><strong>Learned not to run on the ground if you can fly:</strong> This is a long story. I will write another post about it someday when the right time will come..when I'll feel that I have achieved something big. Long story short, I learned how to ignore everything that others are telling/doing and <strong>just focus on what you love to do.</strong></p>
</li>
</ul>
<p>This simple rule was easy to follow when I was in 1st and 2nd year but it became really difficult at the end of 3rd year of my college when our placement season started. Things were a bit different for me as compared to others. I was a core member of an early-stage startup and I had the responsibility of handling the Frontend of the whole platform (app), managing other team members, taking care of their code (collaborating on Github, merging their code, fixing merge conflicts, etc). This was a huge responsibility and I was not able to take out time to prepare for placements. Everybody but me was preparing for the job, doing DSA, apti, and all.. but what I was doing? wakeup-eat-ReactJs-sleep.</p>
<p>I remember myself panicking a lot sometimes thinking about what should I do. Should I also start doing what others are doing or continue to experiment with this startup? My friends often used to tell me "Tumko kya jarurat hai job ki. tumhara to fix hai.." but internally I was also very scared. In my whole college life, I was always involved in some work/internships and that too in the FrontEnd domain so I could not study course subjects (I know most of us don't do), do much of DSA or practice what is generally asked in placement tests/interviews.</p>
<p>Placement season started.. I gave some exams, cleared some but could not perform well in most. Especially the aptitude rounds were simply not doable for me. I somehow reached the interview round for the TCS (yeah, I am from a 3rd tier college and only these company visits our campus). The interview went very nicely.. I answered all the questions and was happy with my performance. But I don't know what they were looking for in a candidate that they rejected me (I even wore formals and tie in the online interview 😅). They didn't even care to give any feedback about why they rejected me 😑. Now I am thinking about why I even sat for such a company that was going to pay me even less than what I already was earning sitting in my room and that too along with attending college. After this incident, I took it as a sign of GOD and did not sit for any other companies. I knew about my expertise and decided that I should not participate in a race where I do not belong.</p>
<p>One important incident I will always remember. During this period there was a shift in my psychological state i.e the way of thinking. Since all of my friends were doing their own thing and sometimes in their own group, I started feeling left out. My thought process became so negative that I started to think that they are selfish and only care about themselves. I even cried (not really.. just a deep voice with some tears in my eyes) one day questioning them why they were doing this. But now I can see that it was a hard time and everyone was going through the same anxiety and pressure. I was too negative to think things like these. They are the best people in my life and I am proud of them. If you are reading this my friends, you guys really are the best. I am so fortunate to have a friend circle like yours. Love you all.</p>
<p>One more important thing, I am so thankful to all the people who supported me emotionally during this period. There were also some people in my LinkedIn connection (yeah, I don't have a girlfriend like others to talk to.. so in such an emotionally difficult situation, I try talking to people at LinkedIn 😅) who spoke to me on call to help me clear my doubts and guide me in the right direction. Thanks to everybody.</p>
<ul>
<li><p><strong>Accepted my first Full-time job offer:</strong> Although I started working from my 2nd year (more seriously from 3rd year) of my college, and have been a part of an amazing company Udacity I recently got an opportunity to become a part of another amazing company (DabbleLab, based in USA, full-time) as a Software Engineer. The best thing, they allowed me to start working right from the day I accepted the offer. I am loving working on different projects and learning new technologies every week. I am so much loving the people and what I am doing here at this company that I can repeat this... I am loving it (recursion 😉)</p>
</li>
<li><p><strong>Became financially independent:</strong> This is what I am proud of. Being from a lower-middle-class family I know the importance of money and how hard it is to earn. I was fortunate to be able to start earning as early as from 2nd year of my college but 2020 was really at another level. From my self-earned money, I paid my college fees, cleared my education loan, bought myself all the fancy stuff I dreamt of having like an iPhone, a Macbook Pro (M1), a big fat 4k monitor, a personal home office/work desk setup, etc. It might not be a big deal for others but for me being able to do all these while still being in my college (I still have 6 months of college to complete) is just amazing and definitely a thing to be proud of.</p>
</li>
<li><p><strong>Helped in building the careers of 1000+ people:</strong> I love helping people by sharing my knowledge. That's why I joined Udacity as a Mentor. At the end of 2020, I have mentored so many students, reviewed 1000+ projects, answered around 400 technical questions, etc. Most of the students at Udacity are working professionals who are learning new technologies to switch their careers or just to add more skills under their belt. I was fortunate enough to help them and be a part of their journey. It was so amazing to talk to people from all over the world and interact with so many talented people. Helping other and reading their feedbacks keeps me motivated and hungry to push myself and learn more.</p>
</li>
</ul>
<p>Recently I was being appreciated for being one of the best mentors at Udacity. I was also chosen among a handful of top mentors to become an Auditor to audit peer performance and keep in check the quality of project reviews done by other mentors.</p>
<ul>
<li><strong>Learned about people.. the good and not so good people in my life:</strong> I obviously can't discuss much about this in public but I can say that I learned who are the people in my life who truly care about me.. and who don't. One take away is that both types of people have a significant contribution to my personal growth and I am thankful for them. The people who love me-- I love you too.. other people-- I love you more ;)
I think this much is enough to write...It's been 6 hrs since I started 😅.. I'll now stop writing more...</li>
</ul>
<p>One fun fact, at this moment (as I complete writing this post) I am wondering if this story is worth sharing? What some of you guys will be thinking after reading this story of mine.. "Why this guy is sharing his story.. has he achieved anything big? He has not even been placed in a big company like FAANG.." but then I remember my 2nd point above. I don't care what others think. Your definition of big achievements/being successful/happy etc is different from mine. I know where I started from, where I am going and I am loving what I'm doing. I am very happy and this is what really matters at the end of the day... Man, I am following my passion... I know even bigger things are coming my way... I just have to keep working hard 🤩</p>
<p><strong>Looking forward to experiencing even more amazing next year.. Welcome 2021</strong> 🎉</p>
<p>(Originally posted <a target="_blank" href="https://www.linkedin.com/pulse/2020-amazing-year-shubham-prakash">here</a>)</p>
]]></content:encoded></item><item><title><![CDATA[REMIX- A new React Framework from the creators of React Router]]></title><description><![CDATA[Finally, a killer React framework from the creators of React Router

If you have been developing Single Page Applications (SPAs) using React you know that there are a couple of problems that creep into our application because of the way react basical...]]></description><link>https://blog.shubhamprakash.dev/remix-a-new-react-framework-from-the-creators-of-react-router</link><guid isPermaLink="true">https://blog.shubhamprakash.dev/remix-a-new-react-framework-from-the-creators-of-react-router</guid><dc:creator><![CDATA[Shubham Prakash]]></dc:creator><pubDate>Wed, 29 Apr 2020 18:44:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1617394974148/R87IJmedR.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>Finally, a killer React framework from the creators of React Router</p>
</blockquote>
<p>If you have been developing Single Page Applications (SPAs) using React you know that there are a couple of problems that creep into our application because of the way react basically works by default. For example, the most common problem, it is very difficult to have good SEO if you are using client-side rendering (CSR) in React.</p>
<p>This is because, in the case of CSR, the data you see on the page is generated by the JavaScript in the browser itself. It is also very difficult to have dynamic Metadata on such websites.</p>
<p>Single-page applications (SPAs) due to these reasons are commonly regarded as non-SEO friendly websites.</p>
<p>You can learn more about the pros and cons of SPAs <a target="_blank" href="https://www.cloudways.com/blog/single-page-website-spa-seo/#single-page">here</a></p>
<p>To solve this problem (along with other problems with CSR), we use different technics like Server-side rendering (SSR), prerendering, etc.</p>
<p>Since it is a bit difficult to do React SSR manually, we have different React frameworks to make our job easy.</p>
<p>One of such React frameworks which is very popular is <a target="_blank" href="https://nextjs.org/">Next.js</a></p>
<p>Similar to frameworks like Next.js, the people who developed <a target="_blank" href="https://reacttraining.com/react-router/web/guides/quick-start">React Router</a> (The most popular routing library for React) are working on a <strong>NEW React framework</strong> to solve all the problems we face while developing with React.</p>
<p>They have named it <a target="_blank" href="https://remix.run/">Remix</a>.</p>
<p>Some of the highlighted features of Remix are as follow-</p>
<ul>
<li>File system routes</li>
<li>Route layout nesting</li>
<li>Automatic code splitting</li>
<li>Data-driven meta tags</li>
<li>Built-in data loading</li>
<li>Location-based Suspense cache</li>
<li>Streaming server rendering</li>
<li>Zero-config build</li>
<li>React Refresh</li>
<li>Server rendering in dev</li>
<li>Deploy anywhere</li>
<li>...and more</li>
</ul>
<p>Here is the first preview of Remix on YouTube. You'll get a preview on routing, layouts, data loading, meta tags, data caching, and scroll restoration etc.</p>
<p>{% youtube MYxwlmeyu9w %}</p>
<p>You can subscribe to follow their progress and get early access here- https://remix.run/</p>
<p>Isn't it cool? Personally, I'm very excited about it. I know its gonna be a big thing because of the people behind it.</p>
<p>Hope you liked this post. You can follow me for more such interesting stories.</p>
<p>You can also connect with me at <a target="_blank" href="https://www.linkedin.com/in/ishubhamprakash/">LinkedIn</a>, <a target="_blank" href="https://twitter.com/isuvm">Twitter</a>, <a target="_blank" href="https://github.com/i-shubhamprakash/">Github</a>, <a target="_blank" href="https://shubhamprakash.dev">shubhamprakash.dev</a></p>
]]></content:encoded></item><item><title><![CDATA[How to enable Chrome's Hidden Bottom Toolbar in Android]]></title><description><![CDATA[I want to share an amazing trick with you that I found today on the internet.
You must have felt it very difficult to reach the Google chrome browsers options and settings in mobile device as it is present at the top of the browser which is very hard...]]></description><link>https://blog.shubhamprakash.dev/how-to-enable-chromes-hidden-bottom-toolbar-in-android</link><guid isPermaLink="true">https://blog.shubhamprakash.dev/how-to-enable-chromes-hidden-bottom-toolbar-in-android</guid><dc:creator><![CDATA[Shubham Prakash]]></dc:creator><pubDate>Tue, 25 Feb 2020 21:35:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1617394990510/PUhH7dl6q.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I want to share an amazing trick with you that I found today on the internet.</p>
<p>You must have felt it very difficult to reach the Google chrome browsers options and settings in mobile device as it is present at the top of the browser which is very hard to reach with your fingers in big screen mobile phones.</p>
<p>Good news, there is a trick using which you can enable a toolbar at the bottom of your browser so that you can access options like switch tab, search and share easily.</p>
<blockquote>
<p>Note- I have done this in my Android phone only so I'm not sure if you can do the same in IOS.</p>
</blockquote>
<p>Here's how you enable this hidden bottom toolbar-</p>
<h3 id="step-1">Step 1:</h3>
<p>In your chrome address bar type the following path-</p>
<pre><code><span class="hljs-attribute">chrome</span>:<span class="hljs-comment">//flags</span>
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1617394980811/8zRA_moyJ.jpeg" alt="Alt Text" /></p>
<h3 id="step-2">Step 2:</h3>
<p>Search for “Duet” in the search bar.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1617394983166/YGthyIxiL.jpeg" alt="Alt Text" /></p>
<h3 id="step-3">Step 3:</h3>
<p>Tap the drop-down menu next to “Chrome Duet” and select any one of the button configuration you want from the drop-down menu.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1617394986324/_sUdrQmCa.jpeg" alt="Alt Text" /></p>
<h3 id="step-4">Step 4:</h3>
<p>:tada: Now restart your browser and enjoy the new bottom toolbar.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1617394988767/4PVv6vM_T.jpeg" alt="Alt Text" /></p>
]]></content:encoded></item><item><title><![CDATA[Trap focus using javaScript]]></title><description><![CDATA[title: Trap focus using javaScript
published: true
description: Setting up custom keys to focus previous/next element in the tab index
tags: Web Development,JavaScript,HTML focus,Event Listener, 
cover_image: https://cdn.hashnode.com/res/hashnode/ima...]]></description><link>https://blog.shubhamprakash.dev/trap-focus-using-javascript</link><guid isPermaLink="true">https://blog.shubhamprakash.dev/trap-focus-using-javascript</guid><dc:creator><![CDATA[Shubham Prakash]]></dc:creator><pubDate>Mon, 20 Jan 2020 13:04:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1617395001470/98DSsAU3o.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<hr />
<p>title: Trap focus using javaScript
published: true
description: Setting up custom keys to focus previous/next element in the tab index
tags: Web Development,JavaScript,HTML focus,Event Listener, </p>
<h2 id="coverimage-httpscdnhashnodecomreshashnodeimageuploadv1617394999377qo1jqqxbrgif">cover_image: https://cdn.hashnode.com/res/hashnode/image/upload/v1617394999377/qO1JqQXBr.gif</h2>
<h3 id="setting-up-custom-keys-to-focus-previousnext-element-in-the-tab-index">Setting up custom keys to focus previous/next element in the tab index</h3>
<h4 id="introduction">Introduction</h4>
<p>On a web page, we have different focusable elements and they follow a default tab order. We can navigate around and change focus from one focusable element to another using <code>Tab</code> and <code>Shift + Tab</code> keys. </p>
<p>You can easily check this behavior on any website. Just press <code>Tab</code> to move your focus to the next focusable element and press <code>Shift + Tab</code> for the previous one. </p>
<p>We can manipulate this default Tab flow and create our own flow using <code>tabindex</code> but this is not the focus of this article. We want to use a custom key to change the focus just like we use <code>Tab</code> and <code>Shift + Tab</code> keys.</p>
<p>In this article, we will learn how to trap the browser focus using javaScript and assign it to <code>UP</code> and <code>DOWN</code> arrow keys to focus the next and the previous focusable elements (<code>input box</code> in our example) </p>
<h4 id="what-we-are-going-to-build">What we are going to build</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1617394997155/TR3V-n3X4.png" alt="Demo page" /></p>
<p>We are going to create a web page having some input fields. We will create a function that will listen to the <code>keypress event</code> and change the focus of the element on pressing arrow UP and DOWN keys.</p>
<p>Let's begin-</p>
<h2 id="setup">Setup</h2>
<ol>
<li>Creating some input fields on the page for the demo:</li>
</ol>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"container"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"text-center"</span>&gt;</span>Trap focus using javaScript<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"input-wrapper"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Input 1"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">""</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Input 2"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">""</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Input 3"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">""</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Input 4"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">""</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Input 5"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">""</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<ol>
<li>Writing some CSS to make this ugly page a little beautiful because why not :wink:</li>
</ol>
<pre><code class="lang-css">
<span class="hljs-selector-tag">html</span>{
  <span class="hljs-attribute">background</span>: black;
}

<span class="hljs-selector-class">.container</span>{
  <span class="hljs-attribute">background</span>: yellow;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100%</span>;
  <span class="hljs-attribute">max-width</span>: <span class="hljs-number">500px</span>;
  <span class="hljs-attribute">margin</span>: auto;
  <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">10px</span>;
}

<span class="hljs-selector-tag">h1</span>{
  <span class="hljs-attribute">padding-top</span>: <span class="hljs-number">0.4em</span>;
}

<span class="hljs-selector-class">.input-wrapper</span>{
  <span class="hljs-attribute">background</span>: pink;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">1em</span>;
  <span class="hljs-attribute">display</span>: flex;
  <span class="hljs-attribute">flex-direction</span>: column;
  <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">0</span> <span class="hljs-number">0</span> <span class="hljs-number">10px</span> <span class="hljs-number">10px</span>;
}

<span class="hljs-selector-class">.input-wrapper</span> <span class="hljs-selector-tag">input</span>{
  <span class="hljs-attribute">margin</span>: <span class="hljs-number">0.4em</span> auto;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">0.4em</span>;
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">1.4em</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">400px</span>
}

<span class="hljs-selector-class">.text-center</span>{
  <span class="hljs-attribute">text-align</span>: center;
}

<span class="hljs-selector-tag">button</span>{
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">0.4em</span>;
  <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">4px</span>;
  <span class="hljs-attribute">margin</span>: auto;
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">1.2em</span>;
  <span class="hljs-attribute">cursor</span>: pointer;
}
</code></pre>
<h2 id="the-javascript-part">The JavaScript part</h2>
<p>We know that the browser fires <code>DOM events</code> on various kinds of events (of course) happening on the page. </p>
<p>We are going to listen to <code>keydown</code> events on the input fields so that whenever the user press UP or DOWN keys we will change the focus on the page to previous or the next element respectively.</p>
<p>Now here's a question, why I chose <code>keydown</code> event for this and not <code>keypress</code>. The answer is compatibility with different browsers. Since I'll be using <code>event.keyCode</code> in this example, I found using <code>keydown</code> or <code>keyup</code> instead of <code>keypress</code> events will work in every major browser.</p>
<p>Alright enough talking, let's get to the coding part-</p>
<p>let's begin with creating a function which we will invoke on <code>keydown</code> event in the browser- </p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">handleInputFocusTransfer</span>(<span class="hljs-params">e</span>)</span>{
<span class="hljs-comment">// we will write code for the functionality here...</span>
}
</code></pre>
<p>Now inside this function, we will write the logic for changing the focus on the page.</p>
<p>let's create a variable to store the reference of all the focusable elements we want to use. 
In our example, we are manipulating focus for input fields but you can use any elements on the page and select them in the same way-</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> focusableInputElements= <span class="hljs-built_in">document</span>.querySelectorAll(<span class="hljs-string">`input`</span>);
</code></pre>
<p><code>document.querySelectorAll</code> will return a node list. we will create an array from this node list using spread operator as follow-</p>
<pre><code class="lang-js">  <span class="hljs-keyword">const</span> focusable= [...focusableInputElements];
</code></pre>
<p>At this point, we have an array <code>focusable</code> of all the focusable elements on the page. The current element which is in focus on the page is also present in this array. So, let's find at which index this guy is sitting-</p>
<pre><code class="lang-js"> <span class="hljs-comment">//get the index of current item in the "focusable" array</span>
  <span class="hljs-keyword">const</span> index = focusable.indexOf(<span class="hljs-built_in">document</span>.activeElement);
</code></pre>
<p>Here, <code>document.activeElement</code> returns the active node element on the page.</p>
<p>Let's also create a variable to store the index of the next element to be focussed-</p>
<pre><code class="lang-js">  <span class="hljs-keyword">let</span> nextIndex = <span class="hljs-number">0</span>;
</code></pre>
<p>I have initialized it with 0 but later we will change it on UP or DOWN arrow key press accordingly.</p>
<p>Now, on <code>keyDown</code> event, the event object has an entry <code>keyCode</code> which stores the ASCII (RFC 20) or Windows 1252 code corresponding to the pressed key.</p>
<p>It is 38 and 40 for the UP and DOWN arrow keys respectively.</p>
<p>Next, we will write a if-else statement which will change the value of <code>nextIndex</code> according to which key was pressed-</p>
<pre><code class="lang-js">  <span class="hljs-keyword">if</span> (e.keyCode === <span class="hljs-number">38</span>) {
    <span class="hljs-comment">// up arrow</span>
    e.preventDefault();
    nextIndex= index &gt; <span class="hljs-number">0</span> ? index<span class="hljs-number">-1</span> : <span class="hljs-number">0</span>;
    focusableInputElements[nextIndex].focus();
  }
  <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (e.keyCode === <span class="hljs-number">40</span>) {
    <span class="hljs-comment">// down arrow</span>
    e.preventDefault();
    nextIndex= index+<span class="hljs-number">1</span> &lt; focusable.length ? index+<span class="hljs-number">1</span> : index;
    focusableInputElements[nextIndex].focus();
  }
</code></pre>
<p>In the if-block above, if the keyCode is 38 (i.e UP arrow key) we are decreasing the value of <code>index</code> by 1 so that just the previous focusable element in the <code>focusableInputElements</code> array can be focussed using <code>focus()</code> method provided by the DOM API.</p>
<p>Similarly, in the else-block, we are increasing the value of <code>index</code> by 1 to focus on the next focusable element.</p>
<p>You'll see I have also taken care of boundary conditions using a ternary operator. This is just to make sure that <code>nextIndex</code> always holds a positive value smaller than the size of the <code>focusableInputElements</code> array to avoid errors.</p>
<p>That's all. Now put these code together inside our <code>handleInputFocusTransfer</code> function and set up an event listener for <code>keydown</code> event on the page.</p>
<p>The whole javascript code now looks like this-</p>
<pre><code class="lang-js">
<span class="hljs-comment">// Adding event listener on the page-</span>
<span class="hljs-built_in">document</span>.addEventListener(<span class="hljs-string">'keydown'</span>,handleInputFocusTransfer);

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">handleInputFocusTransfer</span>(<span class="hljs-params">e</span>)</span>{

  <span class="hljs-keyword">const</span> focusableInputElements= <span class="hljs-built_in">document</span>.querySelectorAll(<span class="hljs-string">`input`</span>);

  <span class="hljs-comment">//Creating an array from the node list</span>
  <span class="hljs-keyword">const</span> focusable= [...focusableInputElements]; 

  <span class="hljs-comment">//get the index of current item</span>
  <span class="hljs-keyword">const</span> index = focusable.indexOf(<span class="hljs-built_in">document</span>.activeElement); 

  <span class="hljs-comment">// Create a variable to store the idex of next item to be focussed</span>
  <span class="hljs-keyword">let</span> nextIndex = <span class="hljs-number">0</span>;

  <span class="hljs-keyword">if</span> (e.keyCode === <span class="hljs-number">38</span>) {
    <span class="hljs-comment">// up arrow</span>
    e.preventDefault();
    nextIndex= index &gt; <span class="hljs-number">0</span> ? index<span class="hljs-number">-1</span> : <span class="hljs-number">0</span>;
    focusableInputElements[nextIndex].focus();
  }
  <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (e.keyCode === <span class="hljs-number">40</span>) {
    <span class="hljs-comment">// down arrow</span>
    e.preventDefault();
    nextIndex= index+<span class="hljs-number">1</span> &lt; focusable.length ? index+<span class="hljs-number">1</span> : index;
    focusableInputElements[nextIndex].focus();
  }
}
</code></pre>
<p>Now our web page looks like this. Note how the focus is changing on pressing UP and DOWN arrow keys-
<img src="https://thepracticaldev.s3.amazonaws.com/i/v9nv6c0gha58d2vlmuqo.gif" alt="Demo page gif" /></p>
<p>DONE!! you've done it. Check out this codepen to see it live-</p>
<p>https://codepen.io/ishubhamprakash/pen/OJPagqj</p>
<p>&gt;
This is my first post on dev.to
Hope you'll like it. Smash whatever buttons this platform provides to appreciate the work let me know that you loved this post  :smile:
&gt;</p>
<p>More posts coming...</p>
]]></content:encoded></item></channel></rss>