<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jobayer Hossain on Medium]]></title>
        <description><![CDATA[Stories by Jobayer Hossain on Medium]]></description>
        <link>https://medium.com/@jobayerdev?source=rss-edd8a5dab9f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ksFJGLuHr4QVQgujGkqT_Q.jpeg</url>
            <title>Stories by Jobayer Hossain on Medium</title>
            <link>https://medium.com/@jobayerdev?source=rss-edd8a5dab9f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:03:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jobayerdev/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[DigitalOcean S3 NestJS Example]]></title>
            <link>https://jobayerdev.medium.com/digitalocean-s3-nestjs-example-65bec8d059b3?source=rss-edd8a5dab9f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/65bec8d059b3</guid>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[s3]]></category>
            <dc:creator><![CDATA[Jobayer Hossain]]></dc:creator>
            <pubDate>Wed, 03 May 2023 09:12:22 GMT</pubDate>
            <atom:updated>2023-05-03T09:12:22.395Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*AsPpeS6xlqOftotLsHbXUw.jpeg" /></figure><p>To implement DigitalOcean Spaces (which is an S3-compatible object storage service) in NestJS for uploading images, you can use the aws-sdk package, which supports DigitalOcean Spaces as well. Here’s a step-by-step guide:</p><p>To implement DigitalOcean Spaces (which is an S3-compatible object storage service) in NestJS for uploading images, you can use the aws-sdk package, which supports DigitalOcean Spaces as well. Here’s a step-by-step guide:</p><p>First, install the aws-sdk package by running the following command:</p><pre>npm install aws-sdk</pre><p>Create a new module in your NestJS application by running the following command:</p><pre>nest g module digitalocean</pre><p>Inside the newly created digital ocean module, create a new service file called digitalocean.service.ts with the following content:</p><pre><br>import { Injectable } from ‘@nestjs/common’;<br>import * as AWS from ‘aws-sdk’;<br><br>@Injectable()<br>export class DigitalOceanService {<br> private s3: AWS.S3;<br>constructor() {<br>   this.s3 = new AWS.S3({<br>   endpoint: &#39;https://your-space-name.nyc3.digitaloceanspaces.com&#39;,<br>   accessKeyId: &#39;your-access-key-id&#39;,<br>   secretAccessKey: &#39;your-secret-access-key&#39;,<br>   region: &#39;nyc3&#39;,<br>   });<br> }<br>async uploadFile(buffer: Buffer, filename: string): Promise&lt;string&gt; {<br>   const params = {<br>     Bucket: &#39;your-bucket-name&#39;,<br>     Key: filename,<br>     Body: buffer,<br> };<br>const { Location } = await this.s3.upload(params).promise();<br>   return Location;<br> }<br>}</pre><p>Note that you should replace the placeholders your-space-name, your-access-key-id, your-secret-access-key, and your-bucket-name with your actual DigitalOcean Spaces details.</p><p>Export the DigitalOceanService from the digitalocean module by adding the following line to the digitalocean.module.ts file:</p><pre>import { Module } from &#39;@nestjs/common&#39;;<br>import { DigitalOceanService } from &#39;./digitalocean.service&#39;;<br><br>@Module({<br>  providers: [DigitalOceanService],<br>  exports: [DigitalOceanService],<br>})<br>export class DigitalOceanModule {}</pre><p>Finally, you can use the DigitalOceanService in any other module of your application by injecting it as a dependency, like this:</p><pre>import { Controller, Post, UseInterceptors, UploadedFile } from &#39;@nestjs/common&#39;;<br>import { FileInterceptor } from &#39;@nestjs/platform-express&#39;;<br>import { DigitalOceanService } from &#39;./digitalocean/digitalocean.service&#39;;<br><br>@Controller()<br>export class AppController {<br>  constructor(private readonly digitalOceanService: DigitalOceanService) {}<br><br>  @Post(&#39;upload&#39;)<br>  @UseInterceptors(FileInterceptor(&#39;file&#39;))<br>  async upload(@UploadedFile() file: Express.Multer.File) {<br>    const buffer = file.buffer;<br>    const filename = file.originalname;<br><br>    const imageUrl = await this.digitalOceanService.uploadFile(buffer, filename);<br><br>    return { imageUrl };<br>  }<br>}</pre><p>In this example, the AppController injects the DigitalOceanService and uses it to upload a file in a POST /upload endpoint using the <a href="http://twitter.com/nestjs/platform-express">@nestjs/platform-express</a> package to handle file uploads. The endpoint returns a JSON object with the uploaded image URL.</p><p>That’s it! You should now be able to upload images to DigitalOcean Spaces from your NestJS application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65bec8d059b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How the Internet works: A Breakdown]]></title>
            <link>https://jobayerdev.medium.com/how-the-internet-connects-us-a-breakdown-ffc1fabb9c98?source=rss-edd8a5dab9f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffc1fabb9c98</guid>
            <category><![CDATA[how-it-works]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[tcp-ip]]></category>
            <dc:creator><![CDATA[Jobayer Hossain]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 08:20:17 GMT</pubDate>
            <atom:updated>2023-01-17T11:20:12.972Z</atom:updated>
            <content:encoded><![CDATA[<p>A computer scientist named Tim Berners-Lee was working at a European physics laboratory called CERN. He had the idea to create a system called the World Wide Web, which would make it easier for people to access and share information on the Internet. Using a simple language called HTML, he developed a way for people to create and view web pages, which are documents that can contain text, images, and links to other web pages. He also created the first web browser, called WorldWideWeb the first web browser was the foundation of the modern Internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ARCcFeSrAL0Hrm4O" /><figcaption>Photo by <a href="https://unsplash.com/@frederikli?utm_source=medium&amp;utm_medium=referral">Frederik Lipfert</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>The Internet is a global network of interconnected devices and servers that communicate with each other using standardized protocols. It allows for the exchange of information and resources, such as sending and receiving emails, accessing websites, and sharing files. The Internet enables communication, education, and commerce on a global scale, and has become an essential tool in modern society.</p><h3>How the Internet Connects Users</h3><p>Before the internet was invented, in a world not so different from our own, people wanted to connect with each other and share information. They wanted to be able to send messages, share pictures and videos, and access information from all over the world. But how could they do this? The answer was the internet.</p><p>The internet is a vast network of devices that are all connected to each other, allowing them to share and exchange information. This network is made up of several key components, such as servers, routers, and modems.</p><p>Servers are like librarians of the internet, they store and manage large amounts of data, making it available to other devices on the internet. Without them, we would not be able to access the websites and information we need.</p><p>Routers are like traffic controllers, they direct data packets between networks, allowing information to be sent and received between devices on different networks.</p><p>Modems are like translators, they convert digital data into a form that can be transmitted over a telephone or cable line, allowing devices to connect to the internet. Without modems, we would not be able to access the internet from our homes.</p><p>But all these components alone are not enough to connect people to the internet. There are also protocols that need to be followed, such as TCP/IP and DNS.</p><p>TCP/IP is like a set of rules that ensures that data is transmitted accurately and efficiently between devices.</p><p>DNS is like a phone book of the internet, it translates domain names, such as <a href="http://www.example.com/">www.example.com</a>, into IP addresses, making it easy for people to remember and access websites. Without DNS, we would have to remember a string of numbers instead of a website name.</p><p>Finally, there are Internet Service Providers (ISPs), the companies that provide internet access to users by maintaining and operating the infrastructure that connects devices to the internet. ISPs are like gatekeepers, they allow us to enter the vast network of the internet and access the world of information.</p><p>And so, with the help of servers, routers, modems, TCP/IP, DNS, and ISPs, people were able to connect to the internet, share information and connect with each other from all over the world. And the internet became an integral part of our daily lives, connecting us in ways we never thought possible.</p><h3>How the Internet Transmits Data</h3><p>Well, imagine that the data you want to send, such as an email or a picture, is like a package that needs to be delivered. The internet uses a method called packet switching to break this package into small pieces called packets. These packets are then sent out into the internet, like a flock of birds flying in different directions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1VPF5Q2EmwqA2d6U" /><figcaption>Photo by <a href="https://unsplash.com/@martenbjork?utm_source=medium&amp;utm_medium=referral">Marten Bjork</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Each packet has a special label on it, called an IP address, that tells it where it needs to go. This is where the Internet Protocol (IP) comes in. IP makes sure that each packet reaches its destination by routing it through the right networks and to the right device.</p><p>But what happens if a packet gets lost along the way? That’s where the Transmission Control Protocol (TCP) comes in. TCP is like a postman that checks to make sure that all the packets have arrived safely and if not, it sends them again.</p><p>Now, packets need a way to travel across the internet, and for that, the internet uses different types of transmission media. Copper wires, Fiber-optic cables, satellites, and wireless are some of the ways packets can travel to their destination.</p><p>Copper wires are like roads, they are widely used to transmit data over short distances. Fiber-optic cables are like superhighways, they are faster and can transmit data over longer distances. Satellites are like airplanes, they transmit data to remote areas where there are no roads or superhighways. And wireless is like a bird, it uses radio waves to transmit data without the need for cables.</p><p>And so, with the help of packet switching, IP, TCP, and different types of transmission media, data is able to travel efficiently and reliably across the internet, connecting people and allowing them to share information from all over the world.</p><h3>Security and Privacy on the Internet</h3><p>Back of time the internet was a relatively new and small network used primarily by researchers and academics. But as it began to grow and become more widely adopted, it became clear that security and privacy were major concerns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OVJCLnKlLrigCJ9o" /><figcaption>Photo by <a href="https://unsplash.com/@possessedphotography?utm_source=medium&amp;utm_medium=referral">Possessed Photography</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As more and more people began to use the internet for sensitive activities such as online banking and shopping, it became apparent that there was a need to protect their personal and financial information from hackers and other malicious actors.</p><p>At the same time, governments and other organizations began to realize that the internet could be used for surveillance and censorship, leading to concerns about privacy and free speech.</p><p>To address these concerns, security experts and privacy advocates began to develop a range of technologies and techniques to protect internet users. Firewalls, encryption, and virtual private networks (VPNs) were invented to protect against unauthorized access and protect users’ data.</p><p>As the internet continued to evolve and become more integrated into our lives, the need for security and privacy became even more important. With the growing use of social media and the proliferation of connected devices, it became increasingly easy for hackers and other malicious actors to access personal information and cause harm.</p><p>As a result, security and privacy have become critical issues that must be considered in the design and use of internet technology. Today, security and privacy experts continue to work to protect internet users from threats and to develop new technologies to improve privacy and security online.</p><p>The story of security and privacy on the internet is an ongoing one, as technology evolves and new threats emerge, the need to protect ourselves and our information will always be present, but with the right tools and knowledge, we can navigate the internet safely.</p><h3>In conclusion</h3><p>As the internet continues to evolve, it is important that we remain vigilant and continue to develop new technologies to protect ourselves and our information online.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffc1fabb9c98" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Simple Angular Component Compilation Process]]></title>
            <link>https://jobayerdev.medium.com/a-simple-angular-component-compilation-process-9338114aff0b?source=rss-edd8a5dab9f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/9338114aff0b</guid>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Jobayer Hossain]]></dc:creator>
            <pubDate>Mon, 05 Sep 2022 16:46:19 GMT</pubDate>
            <atom:updated>2022-09-05T16:46:19.455Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zNHSiYlkftYRecJs" /><figcaption>Photo by <a href="https://unsplash.com/@thomasbormans?utm_source=medium&amp;utm_medium=referral">Thomas Bormans</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In Angular components are internally treated as view data. View-Data is a data structure that holds information about components.</p><h4>Example of Independent Component</h4><p>Let’s say we have a component:</p><pre>@Component({<br> selector: &#39;app-root&#39;,<br> template: `&lt;h1&gt;Hello World&lt;/h1&gt;`,<br>})<br><em>export</em> class AppComponent {}</pre><p>Angular compiler First compiles the template(HTML) and creates a view definition. View definition represents data about tags and bindings within the template. After that create a View data structure from the view definition that holds information about the template and how it should be rendered. Look like this:</p><pre>{<br>    component: new AppComponent(),<br>    nodes: [{<br>        renderElement: &#39;h1&#39;,<br>        text: &#39;Hello World&#39;<br>    }],<br>    def: {}<br>}</pre><p>After that, it will be mapping the view definition with browser DOM. And then create a DOM element for each node in the view definition. And then it will be rendered in the browser. Look like this:</p><pre>&lt;h1&gt;Hello World&lt;/h1&gt;</pre><p>Output:</p><pre>Hello World</pre><p>This is how a basic component is rendered in the browser.</p><h4>Example of Nested Component</h4><p>In composable component. We can use one component inside another component. Let’s say we have a component:</p><pre><a href="http://twitter.com/Component">@Component</a>({<br>    selector: &#39;app-hello&#39;,<br>    template: `&lt;h1&gt;Hello World&lt;/h1&gt;`,<br>})<br>export class HelloComponent {}</pre><p>And we have another component:</p><pre><a href="http://twitter.com/Component">@Component</a>({<br>    selector: &#39;app-root&#39;,<br>    template: `<br>  &lt;h1&gt;App Component&lt;/h1&gt;<br>  &lt;app-hello&gt;&lt;/app-hello&gt;<br> `,<br>})<br>export class AppComponent {}</pre><p>Like Before angular first compiles and creates a view definition and view data structure.</p><p><strong>Hello Component View Definition</strong></p><pre>{<br>    component: new HelloComponent(),<br>    nodes: [{<br>            renderElement: &#39;h1&#39;,<br>            text: &#39;Hello World&#39;<br>        }</pre><pre>],<br>}</pre><p><strong>App Component View Definition</strong></p><pre>{<br>    component: new AppComponent(),<br>    nodes: [{<br>            renderElement: &#39;h1&#39;,<br>            text: &#39;App Component&#39;<br>        },<br>        {<br>            def: HelloComponent<br>        }<br>    ],<br>}</pre><p>So, in the composable component, we can see that the view definition of the child component is added to the parent component view definition. And then it will be mapped to the DOM element as well.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9338114aff0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Drive Into React useEffect Hook]]></title>
            <link>https://medium.com/swlh/drive-into-react-useeffect-hook-89db8f844d92?source=rss-edd8a5dab9f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/89db8f844d92</guid>
            <category><![CDATA[useeffect]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-hook]]></category>
            <dc:creator><![CDATA[Jobayer Hossain]]></dc:creator>
            <pubDate>Sun, 08 Nov 2020 02:56:56 GMT</pubDate>
            <atom:updated>2022-07-10T05:38:43.519Z</atom:updated>
            <content:encoded><![CDATA[<h3>Drive Into React useState Hook</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pj0Bh1qWxiJUSrpLKQzK1w.png" /></figure><h3>A brief introduction about React Hooks</h3><p>React hook is a new feature that was introduced in February of 2019 with react sixteen point eight hooks is a really really exciting feature. It aims to replace the way that we write certain components as well as how we write our applications. Hooks are a way for us to write functional components but gain access to new functionality that was previously only available to us if we wrote class components. We can’t use hook inside the class component. We can only use them inside the functional components.</p><p>So let’s begin…</p><h3>useState</h3><p>useState is exactly like it sounds it allows us functional components to have access to internal state features that we could only leverage before useing class components and the way that usestate works are that it is a function that gets a parameter But before we explore what that parameter is we got to know what useState gives us back. Use state gives us back an array with two values. and in order first, to understand these two values we will actually need to first explore array destructuring.</p><h4><strong>Array destructuring</strong></h4><p>Let’s write an array that is equal to an array of three numbers.</p><pre>const arr = [1, 2, 3]</pre><p>if we wanted to set each of those elements in this array to a constant variable that we went to access with every single variable. we can use what’s called array destructuring. and set them like this.</p><pre>const arr = [1, 2, 3]<br>const [one,two,three] = arr</pre><p>In this snippet, we do this in the order of square brackets that we want the const variables to point to in their respective positions of the array were pointing to. So now if we console log this we’ll see that now</p><p>one = 1 , two = 2 , three = 3</p><pre>const arr = [1, 2, 3]<br>const [one, two, three] = arr</pre><pre>console.log(one) // 1<br>console.log(two) // 2<br>console.log(three) // 3</pre><p>So this is pretty much array destructuring. it just allows us to set variables inside of these square brackets to certain elements in an array.</p><h4>Implement UseState</h4><p>Step 1: First, we create a functional component.</p><p>Step2: Import Hooks.</p><p>Step3: Initialized useState Hooks.</p><p>Step4: Set state Default Value.</p><p>Step:5 Update State Value.</p><h4><strong>Step 1: First, we create a functional component.</strong></h4><p>Create a functional Component</p><pre>import React from &quot;react&quot;;</pre><pre>const UpdateName = () =&gt; {</pre><pre>const [name] = useState();</pre><pre>return (</pre><pre>&lt;div&gt;</pre><pre>&lt;h1&gt;Jobayer&lt;/h1&gt;</pre><pre>&lt;button&gt;Set NickName&lt;/button&gt;</pre><pre>&lt;/div&gt;</pre><pre>);</pre><pre>};</pre><pre>export default UpdateName</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5247772af431e0dbd2bd35a58b3b1b34/href">https://medium.com/media/5247772af431e0dbd2bd35a58b3b1b34/href</a></iframe><h4><strong>Step2: Import Hooks.</strong></h4><p>Now at the top, we import the useState hook from React.</p><pre><em>import</em> React, { useState } <em>from</em> &quot;react&quot;</pre><h4>Step3: Initialized Hooks.</h4><pre>const [name, setName] = useState()</pre><p>useState gives us back two parameters inside of our array. So we destructuring those two things that we get back. The first one is going to be the state value itself that we’re trying to set. Now we can name this whatever we want. But it’s pretty much going to be the variable that we want our state to hold. So here for example we’re trying to set a name into this state. so I’m set to call it a name. The second thing we get back from the state is a function that allows us to set this property and this I’m going to call setName.</p><h4>Step4: Set state Default Value.</h4><pre>const [name, setName] = useState(&quot;Jobayer&quot;)</pre><p>Now what we pass into this state is going to be the value that we want the initial value of this state. So for example we’re trying to set a string. I’m just going to set the state initial value to a string value of “Jobayer” and now I’m actually able to use these values inside of my component and ‘name’ now equal that state value.</p><h4>Step:5 Update State Value.</h4><p>If we wanted to change that value we just simply call our setName feature and then pass it the value we want to change this name-value too. So now I can just set it to ‘Kishoyar’.</p><pre>import React, { useState } from &quot;react&quot;</pre><pre>const UseState = () =&gt; {</pre><pre>const [user, setUser] = useState(null)</pre><pre>const [searchQuery, setSearchQuery] = useState(&quot;Sfonia&quot;)</pre><pre>return (</pre><pre>&lt;div&gt;</pre><pre>&lt;input</pre><pre>type=&quot;search&quot;</pre><pre>value={searchQuery}</pre><pre>onChange={(event) =&gt; setSearchQuery(event.target.value)}</pre><pre>/&gt;</pre><pre>{user ? (</pre><pre>&lt;div&gt;</pre><pre>&lt;h3&gt;{user.name}&lt;/h3&gt;</pre><pre>&lt;h3&gt; {user.username} &lt;/h3&gt;</pre><pre>&lt;h3&gt; {user.email} &lt;/h3&gt;</pre><pre>&lt;/div&gt;</pre><pre>) : (</pre><pre>&lt;p&gt;No user found&lt;/p&gt;</pre><pre>)}</pre><pre>&lt;/div&gt;</pre><pre>)</pre><pre>}</pre><pre>export default UseState</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38daa366f4986a5ba7052b9a796d2dc4/href">https://medium.com/media/38daa366f4986a5ba7052b9a796d2dc4/href</a></iframe><p>Now if we run our application with this code we’ll see that when I click my button it does change the state of my new functional component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*f__K3W-1zLE_kPJefXpPKQ.gif" /></figure><p>The thing about this state here is that typically if we had multiple values we would have to put them all into the same state object. For example, if we also wanted an address we would have to do it like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00ae1725560440fbe9fda5c034ce6add/href">https://medium.com/media/00ae1725560440fbe9fda5c034ce6add/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89db8f844d92" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/drive-into-react-useeffect-hook-89db8f844d92">Drive Into React useEffect Hook</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Complete Guide CSS Flexbox]]></title>
            <link>https://medium.com/better-programming/a-complete-guide-css-flex-box-24f4a9a1e02?source=rss-edd8a5dab9f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/24f4a9a1e02</guid>
            <category><![CDATA[flexbox]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Jobayer Hossain]]></dc:creator>
            <pubDate>Sun, 17 May 2020 15:13:25 GMT</pubDate>
            <atom:updated>2020-05-18T15:19:32.643Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Complete Guide to CSS Flexbox</h3><h4>Everything you need to know to lay out your page with Flexbox</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8uRLelCb2YydoaFmDi6nHw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@olga_o?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Olga O</a> on <a href="https://unsplash.com/s/photos/layout?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>.</figcaption></figure><p>CSS flexbox is a one-dimensional layout pattern that makes it easy to design flexible and effective layouts. Divide space between items and control their alignment in a given container flex layout. It also provides a lot of flexibility. With flexbox, we can organize items from left to right, top to bottom, and at the same time control the spacing and order of the items in the container.</p><h3>How Does It Work?</h3><p>In flexbox, there are mainly two entities: a parent container (the flex container) and the immediate children elements (flex items).</p><p>We also have to deal with the axes: the main axis and the cors axis. By default, the main axis runs left to right, whereas the cors axis is perpendicular to the main axis and runs top to bottom.</p><h3>Parent Container Properties</h3><p>These are some of the properties that can be applied to a flex parent container:</p><ul><li>display</li><li>flex-direction</li><li>flex-wrap</li><li>flex-flow</li><li>justified-content</li><li>align-items</li><li>align-content</li></ul><h4>Without Flexbox</h4><pre>&lt;div class=&quot;box&quot;&gt;<br>    &lt;div class=&quot;box-item&quot;&gt;1&lt;/div&gt;<br>    &lt;div class=&quot;box-item&quot;&gt;2&lt;/div&gt;<br>    &lt;div class=&quot;box-item&quot;&gt;3&lt;/div&gt;<br>&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*BrV8QYkFPF9g8twfQFHEiw.png" /><figcaption>Output</figcaption></figure><h3>display</h3><p>First, we have the display property. This is what defines the flex container and it’s mandatory when working with Flexbox.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54fe146dd7d6c3730b377b6e23c795c8/href">https://medium.com/media/54fe146dd7d6c3730b377b6e23c795c8/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*CIYHZytQmJ2KBPBJG3QGtA.png" /><figcaption>Output</figcaption></figure><h3>flex-direction</h3><p>Next is flex-direction, which defines the direction in which the flex items are placed in the container. Changing the value of the flex-direction property allows us to change how the items. flex-direction can accept one of four values:</p><ul><li>row</li><li>row-reverse</li><li>column</li><li>column-reverse</li></ul><h4>flex-direction: row</h4><p>the first value is a row that is the default value of flex-direction. It doesn’t make any changes by default. It’s placed on the main axis from left to the right.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5951d2f749fc8de34e1d640d7c887e60/href">https://medium.com/media/5951d2f749fc8de34e1d640d7c887e60/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*YuRF3L0sQHSHbj3DbbhFXA.png" /><figcaption>Output</figcaption></figure><h4>flex-direction: row-reverse</h4><p>This sets the main access direction from right to left, which results in the flex items being placed from right to left. In the example below, you can see that the items are now placed in the reverse order. Item 1 is placed to the right:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9488f374c0bf30f548a67564ce43f987/href">https://medium.com/media/9488f374c0bf30f548a67564ce43f987/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*PEiAM4rlUV264fTsAzVm2g.png" /><figcaption>Output</figcaption></figure><h4>flex-direction: column</h4><p>When you set flex-direction to column, the main axis goes from top to bottom, so the items are now stacked on top of each other:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64b2f69485aca58cba59101ed08854ef/href">https://medium.com/media/64b2f69485aca58cba59101ed08854ef/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*LrsaR6a-VcbRFy04WQJpzQ.png" /><figcaption>Output</figcaption></figure><h4>flex-direction: column-reverse</h4><p>We also have column-reverse, which stacks the items in the reverse order. Look at the example below. You can see Item 1 is at the bottom and Item 3 is at the top:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7de58da590ac15c75182d119fb227dbe/href">https://medium.com/media/7de58da590ac15c75182d119fb227dbe/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*SfNMkD5dH350QJ3yzGSZIA.png" /><figcaption>Output</figcaption></figure><h3>flex-wrap</h3><p>flex-wrap is used to control the wrapping of items within a container. If we reduce the browser width, we lose some items for the browser width. The behavior changes with the flex-wrap property. It can accept three possible values:</p><ul><li>nowrap (default value)</li><li>wrap</li><li>wrap-reverse</li></ul><h4>flex-wrap: nowrap</h4><p>This is the flex-wrap property default value. If you set the property value to nowrap, there are no changes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/584d78d8aeb9a35b030eca5eb436928f/href">https://medium.com/media/584d78d8aeb9a35b030eca5eb436928f/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*xeoeCjGT6Gy7p_9sLwCA8Q.png" /><figcaption>Output</figcaption></figure><h4>flex-wrap: wrap</h4><p>When you set the flex-wrap property to wrap, you reduce the browser width that the items have wrapped in the container:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b36eaa333333ec1468ce6383fee6a578/href">https://medium.com/media/b36eaa333333ec1468ce6383fee6a578/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*SCP0dsgy8E_NdZHxSq2Slw.png" /><figcaption>Output</figcaption></figure><h4>flex-wrap: wrap-reverse</h4><p>Instead of items falling into the row below, they climb into the row above. Wrapping always occurs from the last item. wrap-reverse pushes the last item above instead of below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/76e3315b293e18638d9a7f79199c5a1a/href">https://medium.com/media/76e3315b293e18638d9a7f79199c5a1a/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*HPH48EkTnuxBHR7qnksn5Q.png" /><figcaption>output</figcaption></figure><h3>flex-flow</h3><p>flex-flow is shorthand for the combination of flex-direction and flex-wrap. In flex-flow, firstValue is for flex-direction and secondValue is for flex-wrap.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/05b171c23196279e3c334148f4e9dcd8/href">https://medium.com/media/05b171c23196279e3c334148f4e9dcd8/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*PzJgLu1ppfvoSjM7LdgdPQ.png" /><figcaption>Output</figcaption></figure><h3>justified-content</h3><p>justified-content defines the alignment of the items along the main axis. There are six possible values for the justified-content property:</p><ul><li>flex-start</li><li>flex-end</li><li>center</li><li>space-between</li><li>space-around</li><li>space-evenly</li></ul><h4>justified-content: flex-start</h4><p>Setting the value to flex-start places the flex items at the beginning of the main axis, which is also known as the main start. flex-start is the default value in this property.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/98463c799a84d588136cbd1ba5ad84a1/href">https://medium.com/media/98463c799a84d588136cbd1ba5ad84a1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*px40wGVaVRbu9bl5zoKR-A.png" /><figcaption>Output</figcaption></figure><h4>justified-content: flex-end</h4><p>This aligns the items to be placed at the end of the main axis:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7aa4ce252c5c0cb6b79fb2a495dfc02a/href">https://medium.com/media/7aa4ce252c5c0cb6b79fb2a495dfc02a/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*LgeOLZEEh-LAn6g6LWVP7g.png" /><figcaption>Output</figcaption></figure><h4>justified-content: center</h4><p>The center value aligns all content at the center of the main axis:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e63b75f25ee22e14f0de38a7c896fc51/href">https://medium.com/media/e63b75f25ee22e14f0de38a7c896fc51/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*U4q5IVo2ORAexAT_-ORrrA.png" /><figcaption>Output</figcaption></figure><h4>justified-content: space-between</h4><p>This value helps to evenly split extra space and add it in between the flex items:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a66de8b182294dabbf787e3b1f7a56e3/href">https://medium.com/media/a66de8b182294dabbf787e3b1f7a56e3/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*XlX7VKjnGSThVBw9roVcaA.png" /><figcaption>Output</figcaption></figure><h4>justified-content: space-around</h4><p>This value splits the extra space at the beginning and the end. The space in question is equal to half of the space between the flex items:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7dc72677b88e3967d907a0efeab68fee/href">https://medium.com/media/7dc72677b88e3967d907a0efeab68fee/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*u-97Eq-f9CkCGNyNxIbzuw.png" /><figcaption>Output</figcaption></figure><h4>justified-content: space-evenly</h4><p>This value distributes the extra space in the container:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df43ed05b71468831b6d83a227c6e8c3/href">https://medium.com/media/df43ed05b71468831b6d83a227c6e8c3/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*Fwa-k1wy966ve3Oo6cG1lw.png" /><figcaption>Output</figcaption></figure><h3>align-items</h3><p>The align-items property defines how the flex items are laid out along the cross axis.</p><ul><li>align-items: stretch</li><li>align-items: flex-start</li><li>align-items: flex-end</li><li>align-items: center</li><li>align-items: baseline</li></ul><h4>align-items: stretch</h4><p>The items stretch the entire length of the cross axis and stretch is the default value:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec03428f343cffaedd12341c53c56b83/href">https://medium.com/media/ec03428f343cffaedd12341c53c56b83/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*Sf6hZZh9Cmrx5RgP5wo8yA.png" /></figure><h4>align-items: flex-start</h4><p>This is the starting point of the cross axis. The cross axis flows from top to bottom. The item doesn’t stretch and is aligned with the cross start of the line:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fe6c6e877b73c9050bdb36ac6891383/href">https://medium.com/media/5fe6c6e877b73c9050bdb36ac6891383/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*v8Gvn6HfVduWuA2Ijf-rSA.png" /></figure><h4>align-items: flex-end</h4><p>This value pushes the items to the end of the cross axis:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f448f39b45fec9af36daa87f7f5b60ee/href">https://medium.com/media/f448f39b45fec9af36daa87f7f5b60ee/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*Ug1qxYs2ZtgnN8CzCYXfkA.png" /></figure><h4>align-items: center</h4><p>This centers the content along the cross axis:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f253f9ee5588244eb51094a6a9321f00/href">https://medium.com/media/f253f9ee5588244eb51094a6a9321f00/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*sauD7LwE1pb08_s8yWFUDA.png" /></figure><h4>align-items: baseline</h4><p>The baseline is the line upon which most letters sit. The item itself is positioned based where the text will sit:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8234a72f6c46d656de0849307606a06/href">https://medium.com/media/b8234a72f6c46d656de0849307606a06/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*oHX2Is1NYl4fCwuFmn84lA.png" /></figure><h3>align-content</h3><p>align-content is similar to justify-content with the difference being this will align along the cross axis instead of the main axis. Also, align-content works only when there are multiple rows of flex items in the container. The container must have a height and also wrapping.</p><ul><li>align-content: stretch</li><li>align-content: flex-start</li><li>align-content: flex-end</li><li>align-content: center</li><li>align-content: space-between</li><li>align-content: space-around</li></ul><h4>align-content: stretch</h4><p>This is the align-content default value. It has no effect on alignment.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/168dceb86bc5ecf07b33cbe001cef22a/href">https://medium.com/media/168dceb86bc5ecf07b33cbe001cef22a/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*LekPgbIbSZef0RhhYUDdLw.png" /></figure><h4>align-content: flex-start</h4><p>This value pulls the lines to the beginning of the cross axis:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e59d4f523b3e23cee7feec32b0682091/href">https://medium.com/media/e59d4f523b3e23cee7feec32b0682091/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*UEz33kNF88xDHCS0aV4dPw.png" /></figure><h4>align-content: flex-end</h4><p>This value pushes the lines to the end of the cross axis:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d339178348cacdc550ae22fd6ffede6/href">https://medium.com/media/5d339178348cacdc550ae22fd6ffede6/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*yI3f3KXCOKCIh4wEQXsCIA.png" /></figure><h4>align-content: center</h4><p>This value pushes the lines to the center of the cross axis:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/398ad3718fc0bc960c4993e06cd24336/href">https://medium.com/media/398ad3718fc0bc960c4993e06cd24336/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*i14mGiLgYSLojHJ1yPfpLA.png" /></figure><h4>align-content: space-between</h4><p>This value takes all the extra space and puts it in between the lines:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8c1d0c447de42b8d32d8de5bf4cfc3f/href">https://medium.com/media/e8c1d0c447de42b8d32d8de5bf4cfc3f/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*tkS8w_FWJsahj3JbjAGRLQ.png" /></figure><h4>align-content: space-around</h4><p>This distributes the space around the lines:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8614f5695f9e11d095172ba7019ed4d3/href">https://medium.com/media/8614f5695f9e11d095172ba7019ed4d3/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*yxmKBdno0u4IjdnVvbWbIQ.png" /></figure><h3>Flex Item Properties</h3><ul><li>order</li><li>flex-grow</li><li>flex-shrink</li><li>flex-basis</li><li>flex</li><li>align-self</li></ul><h4>order</h4><p>The order property manages the order in which the item arrives in the flex container. All item defaults have an order of zero:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/11e9267a124c10fe2cb5d51817c6bb64/href">https://medium.com/media/11e9267a124c10fe2cb5d51817c6bb64/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*BBNf0QRDREIBm6Oxre6Rmw.png" /></figure><h4>flex-grow</h4><p>flex-grow allows a flex item to grow if necessary. This property specifies what amount of space inside the flex container the item should take up if necessary. All flex items have a flex-grow of zero.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea29e1b553a8cea7ad416fb388054e1c/href">https://medium.com/media/ea29e1b553a8cea7ad416fb388054e1c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*0k7kKswKyRUpqN-kmyWBvQ.png" /><figcaption>Output</figcaption></figure><h4>flex-shrink</h4><p>flex-shrink defines the capacity for a flex item to shrink if necessary. The default value of flex-shrink is one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f50f3069f541e9eff238ff059935c87c/href">https://medium.com/media/f50f3069f541e9eff238ff059935c87c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*VRzYKwb5x8i7UNO6N_yUcw.png" /></figure><h4>flex-basis</h4><p>flex-basis specifies the initial main size of a flex item before the extra space in the container is distributed:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ba1f67107a3fd1d4dc8977ffe020789/href">https://medium.com/media/0ba1f67107a3fd1d4dc8977ffe020789/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*WB2a7UjrKf5UB2YGFJN2nw.png" /></figure><h4>flex</h4><p>The flex property is shorthand for flex-grow, flex-shrink, and flex-basis.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f454362fdf332253fff3e3ca7777c71f/href">https://medium.com/media/f454362fdf332253fff3e3ca7777c71f/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*lCakYBMovAq4o_dIpXEyhw.png" /></figure><h4>align-self</h4><p>The align-self property allows the alignment of individual flex items:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55949639df64ea2eb2aa79479c429971/href">https://medium.com/media/55949639df64ea2eb2aa79479c429971/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*pAyH99rgOnPjJTx1m51LXQ.png" /></figure><h3>Conclusion</h3><p>Thanks for reading.</p><p>If interested, you can view more resources on <a href="https://www.youtube.com/playlist?list=PLC3y8-rFHvwg6rjbiMadCILrjh7QkvzoQ&amp;pbjreload=10">YouTube</a> and also play the <a href="https://flexboxfroggy.com/"><em>Flexbox Froggy</em></a><strong> </strong>game.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24f4a9a1e02" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/a-complete-guide-css-flex-box-24f4a9a1e02">The Complete Guide CSS Flexbox</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with React Credit Card]]></title>
            <link>https://medium.com/better-programming/getting-started-with-react-credit-card-ac44071eeb45?source=rss-edd8a5dab9f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac44071eeb45</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Jobayer Hossain]]></dc:creator>
            <pubDate>Tue, 24 Mar 2020 12:12:55 GMT</pubDate>
            <atom:updated>2020-05-11T12:49:32.379Z</atom:updated>
            <content:encoded><![CDATA[<h3>Get Started With React Credit Card</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n9DZ9LW2gXtykvlX0BBTog.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@rupixen?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">rupixen.com</a> on <a href="https://unsplash.com/s/photos/credit-card?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In this tutorial, we’ll learn about an interesting React npm package called <a href="https://github.com/Jobayerdev/react-credit-card">react-credit-card</a>.</p><p>• <a href="https://econ47.netlify.com/">Demo</a></p><p>First, we create a React app with the npm command line. Open your terminal, and run npx create-react-app myapp after you create your React app. Then type the command npm start. Before you start your app, you need to go to the project directory with cd myapp, and then you run your app.</p><p>OK, now let’s move onto our react-credit-card project.</p><h3>Install</h3><pre>npm install --save react-credit-cards</pre><p>After you install, you need to start your app again with npm start.</p><h3>SetUp</h3><p>Now we create a components folder in your src directory. In this folder, we create a file and name it MyCards.js. Now our folder structure looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*-pUwmKF1t94cfwS6epViFA.png" /><figcaption>Home Directory</figcaption></figure><p>Open your MyCards.js file, and create a simple functional React component. Now our MyCards.js file looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*i_T3m4O1iuWfJli1_1SudQ.png" /></figure><p>OK, now we’ll import some things from our react-credit-cards package. We import two things from react-credit-cards and place our Mycards.js file at the top.</p><ul><li>Cards: import Cards from &quot;react-credit-cards&quot;</li><li>Style sheet: import &quot;react-credit-cards/es/styles-compiled.css&quot;</li></ul><p>So far, our MyCards.js file looks this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TmGUS1JtQvlOuhk9_j8Afg.png" /><figcaption>MyCards.js</figcaption></figure><p>After we successfully import the cards and the style sheet, we move onto actually coding.</p><ul><li>Create a state, and define the default value as an object</li><li>Create a form, and also create a change handler</li></ul><p>So now our MyCards.js look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0DwgPJm-HajjdQV3HDY4ng.png" /><figcaption>MyCards.js</figcaption></figure><p>After you successfully do this step, it’s time to implement our Cards component which provided our react-credit-cards package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*t0P99v1VWbrZqWbe1mmHUw.png" /></figure><p>The card component accepts four arguments as props: CVC, expire, name, and number. This pass our value from input box to this component’s props using the state.</p><p>So far, our MyCards.js file has all of this code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b84dd4dc503ecab748351a032c6e82ba/href">https://medium.com/media/b84dd4dc503ecab748351a032c6e82ba/href</a></iframe><p>OK, now our work is done in the App.js file. We import the MyCards.js file and render. So open your App.js file in the src directory, and paste this code. This code just imports our MyCards.js components.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39a5cc2c2230ce6abe15af6201f65790/href">https://medium.com/media/39a5cc2c2230ce6abe15af6201f65790/href</a></iframe><h3>Styling</h3><p>In App.css, just grab this code, and paste it. It’s made fun.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/820cb8309f33cb95e708c86fcf559fdd/href">https://medium.com/media/820cb8309f33cb95e708c86fcf559fdd/href</a></iframe><p>We completed our app now. Open terminal, and run npm start. I hope you can see your output like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*pXNHuGdjixnIEa0uk5mhtQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac44071eeb45" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/getting-started-with-react-credit-card-ac44071eeb45">Getting started with React Credit Card</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>