<?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: Khayrul</title>
    <description>The latest articles on DEV Community by Khayrul (@khayrul).</description>
    <link>https://dev.to/khayrul</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%2F778793%2Fbcbb47d5-fbdd-4b97-8e1b-089cb4c0b73b.jpeg</url>
      <title>DEV Community: Khayrul</title>
      <link>https://dev.to/khayrul</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/khayrul"/>
    <language>en</language>
    <item>
      <title>Next JS - 2022</title>
      <dc:creator>Khayrul</dc:creator>
      <pubDate>Fri, 25 Feb 2022 11:22:00 +0000</pubDate>
      <link>https://dev.to/khayrul/next-js-4c6a</link>
      <guid>https://dev.to/khayrul/next-js-4c6a</guid>
      <description>&lt;p&gt;&lt;strong&gt;Text JS&lt;/strong&gt;&lt;br&gt;
Next JS is a React JS framework for production. Simply, Next is a package that uses React JS for building the user interface. It has a lot of features that enable developers to build fledged production-ready applications. It has so many features like routing, styling authentication, bundle optimization, SEO, etc. There’s no need to install additional packages, everything it provides us automatically.&lt;br&gt;
&lt;strong&gt;Why Learn Next JS?&lt;/strong&gt;&lt;br&gt;
There are so many reasons to use Next JS instead of React JS. Next JS simplifies the process of building a React application for production. Some major benefits of Next JS are,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;File-based routing&lt;/li&gt;
&lt;li&gt;Pre-rendering&lt;/li&gt;
&lt;li&gt;API routes&lt;/li&gt;
&lt;li&gt;Support of CSS modules&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Development and production build system&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;File-based Routing&lt;/strong&gt;: In Next JS no need to configure any url for routing. All files in pages folder automatically works as route.&lt;br&gt;
&lt;strong&gt;Pre-rendering&lt;/strong&gt;: Next JS allows to set pre-rendering method for each page where most of pages follow static generation and other pages will use server side rendering.&lt;br&gt;
&lt;strong&gt;API routes&lt;/strong&gt;: This week we have worked on four major features in our website. API routes provide a solution to build your API with Next. js. Any file inside the folder pages will be treated as an API endpoint instead of a page.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
    </item>
    <item>
      <title>JWT Token</title>
      <dc:creator>Khayrul</dc:creator>
      <pubDate>Thu, 23 Dec 2021 15:55:43 +0000</pubDate>
      <link>https://dev.to/khayrul/jwt-token-sql-vs-nosql-40ec</link>
      <guid>https://dev.to/khayrul/jwt-token-sql-vs-nosql-40ec</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is JWT token?&lt;/strong&gt;&lt;br&gt;
JWT stands for JSON web Token. It makes a secure way to identify a signed user and serve information to the user. It shares information between two parts. They are server-side and client-side. JWT token saves the information by a special token.&lt;br&gt;
&lt;strong&gt;Why use JWT token?&lt;/strong&gt;&lt;br&gt;
JWT is a standard way to make a security system more strong. Now almost every modern app or web authority uses JWT tokens to give security to their users. JWT is a secure way to authenticate a user and share information. JWT saves user information with a secret token. The spatial token carries the information into it.&lt;br&gt;
&lt;strong&gt;How JWT works?&lt;/strong&gt;&lt;br&gt;
JWT commonly contains some claims. These claims determine that who uses the token, how long it is valid and what permissions the client will get. The JWT token is made up of three parts and these are separated by dot(.). Once a client will get authenticated a unique token will generate for him. And this unique token saves some information about the authenticated user. When the token will be decoded it gives a JSON string. In this JSON string, we will get three things&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Header&lt;/li&gt;
&lt;li&gt;Payload&lt;/li&gt;
&lt;li&gt;Signature&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;strong&gt;header&lt;/strong&gt; contains the type of token&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;payload&lt;/strong&gt; contains all claims. This is a JSON object. The information verifies the user and performs the action that the user requests.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;signature&lt;/strong&gt; makes sure that the token has not changed&lt;/p&gt;

</description>
      <category>database</category>
      <category>programming</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>React context API</title>
      <dc:creator>Khayrul</dc:creator>
      <pubDate>Wed, 22 Dec 2021 09:50:14 +0000</pubDate>
      <link>https://dev.to/khayrul/react-context-api-1dj0</link>
      <guid>https://dev.to/khayrul/react-context-api-1dj0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Context API&lt;/strong&gt; is a new addition of React JS. It's an awesome feature is react. Context API makes the state management system becomes more manageable. Before coming context API, we passed state from one component to another component using props and the way was harder because, in a large application, it will be uncontrollable. Here context API helps us a lot and It is the best way to ignore props drilling. In the context API part, we will learn different purposes of context API and how to create a context, and how to use it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Uses of context API and a simple example:&lt;/strong&gt;&lt;br&gt;
We can create a context API in four steps,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, we have to create a context using createContext method&lt;/li&gt;
&lt;li&gt;Then we have to wrap all necessary components using Context.Provider where we want to pass the context value. &lt;/li&gt;
&lt;li&gt;Then pass the value using value props inside Context.Provider.&lt;/li&gt;
&lt;li&gt;Then we can read or use the provided value using Context.Consumer or using useConetxt hook.
&lt;strong&gt;Example:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { createContext, useContext } from 'react';
export const MyContext = createContext();
function App() {
  const name = "Khayrul"
  return (
    &amp;lt;MyContext.Provider value={name}&amp;gt;
      &amp;lt;Author /&amp;gt;
    &amp;lt;/MyContext.Provider&amp;gt;
  )
}
const Author = () =&amp;gt; {
  const value = useContext(MyContext);
  return &amp;lt;h1&amp;gt;{value}&amp;lt;/h1&amp;gt;;
}
export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;React Context API vs Redux:&lt;/strong&gt;&lt;br&gt;
Many people think that, is context PAI replace Redux. The answer is No. Because some of the case context API is helpful and some of the case Redux is not ignorable.&lt;/p&gt;

&lt;p&gt;Redux is a complete state management library. Redux is an efficient way to manage the state and in some cases, it is mandatory to use. In a large application, we may have so many states, and managing those states using context API or props drilling is very difficult. Here we should use Redux.&lt;br&gt;
On the other hand, in a small application, using redux is not preferable, and it's one kind of harmful. Because for a simple action we have to write code in three or more files. Here we use context API or props drilling system.&lt;/p&gt;

</description>
      <category>react</category>
    </item>
  </channel>
</rss>
