Podcast Lookup

React JS Coding Challenge #1 – Complete Solution and Step-by-Step Explanation

ReactJS Developers Podcast

  • December 3, 2026
  • 1 h 2 min
  • Episode 32
Episode page
About this episodeThe best way to master React JS is by putting your knowledge into practice. In this episode, we tackle and solve the first React coding…
The best way to master React JS is by putting your knowledge into practice. In this episode, we tackle and solve the first React coding challenge, helping you strengthen your problem-solving skills and apply the React concepts you've learned.Through a practical, step-by-step solution, you'll learn how to approach React development challenges, structure your components, implement the required functionality, and understand the reasoning behind the solution.Whether you're learning React as a beginner or preparing for technical interviews, this challenge will help you build confidence and become a better React developer.What You'll Learn
  • How to approach and solve React JS coding challenges.

  • Applying React fundamentals to practical problems.

  • Breaking down a programming problem into manageable steps.

  • Creating and organising functional components.

  • Working with props and component state where required.

  • Implementing application logic in React.

  • Debugging common React development errors.

  • Understanding the solution step by step.

  • Improving logical thinking and problem-solving skills.

Who Should Watch?
  • Beginners learning React JS.

  • Students practising React coding challenges.

  • Frontend developers improving their problem-solving abilities.

  • JavaScript developers transitioning to React.

  • Developers preparing for React technical interviews.

Transcript

From the publisher

This transcript comes from the podcast’s own feed, shown as the publisher wrote it.

React JS Coding Challenge #1 – Complete Solution and Step-by-Step Explanation

00:00—
  1. Speaker 1

    So, I had given you a challenge through which all your things were going to be revised. So, I hope you have completed it. In the challenge, you had a card like this. And I opened it multiple times. You had a card like this. You had to make this card. I had given you some four steps in which these three steps should have been done by you. First of all, you had to build a component. You had to make a card, basically a card component in which you had to keep a style like this. You had to make this card. And after that you have to make this component dynamic using props. So that you don't have to replicate the UI again and again. You simply replicate the component and send the props. And thirdly, you have to style a layout using a grid. And I told you that you have to use Tailwind only. You don't have to use anything other than Tailwind. So, you have to style a grid using Tailwind. Along with that, you have to style a card. And the whole thing. I told you that this is done. This was so far. Which I have already told you. After that, I told you that if you have done JavaScript properly, then definitely you will know about JSON as well. So you have to use JSON to map the cards and again you have to send the props and list all the cards of different multiple users. You have to make a grid structure and list the whole card. So I have given you this much work. Maybe you have done it, maybe you have not done it. Now I will tell you, you can follow it. If you have done it, then it is very good. Look at 2x, there is no problem. So we have to make this card. So quickly, first of all, I come to the Tailwind site. I will open the docs and you know how to install all this. I will show you how to install it. I will show you how to install it. I will show you how to install it. First of all, we have to install VEET, then we will install Tailwind. And we will give the name of the project simply. What name should I give? Let's give the name of the challenge. And here we will go inside the challenge folder by doing CD challenge. So this will be our project here. Now see there is no challenge folder here. I will make it here simply. Wait a minute. Oh man! Ok. So this is react javascript. So see here our challenge folder is made. And now what we have to do is to install node modules. So for that they have given second command. Copy this. And simply copy paste copy paste. Do as they are telling you. And keep in mind that you have come inside the challenge folder. I have done here CD challenge. So I have come inside the challenge folder. So I have to do all my work inside this challenge folder. So I have Here I paste the command and enter it. Now it is being installed. Let it be. After that, what to do? After that, you simply have to import it. Where? V.config.js. Can you see it? See this. Where did it go? See this. V. This one was not there. Wait a minute. This is done. Then here in V.config.js, you have to paste this one. How much time is it taking to install? It also depends a little on the net. So this is our install. And here you will find the challenge folder with the V.config.js. I have told you all this, so I am doing it quickly here. So that your revision is done. And here react is already there, you don't have to do it, you have to put your tailwind here. Alright. Then CSS, here in any global CSS, whether you put it in app.css or index.css. So the main global CSS you have is index.css. So I remove this default in index.css and we use our tailwind, we import it. Then after that it happened, then we will run it from npm run dev and then they have told the way to use it in this way. Very good. So let's close this, let's close this and let's close this too. You have understood the challenge. Let's quickly run from NPM run dev here. And it has been run. Let's quickly open it on the browser too. So see this style is completely spoiled because we have removed the default style from here. Okay. Let's remove the default style of app.css too. Alright. And let's hide it from here. Don't kill, hide. All right, so let's close this tailwind and we have to make this. Very good. Let's come to app.jsx. Let's do the cleaning quickly. I don't know how many times you have done this. This is our neat and clean. And let's check quickly if our tailwind is working or not. Let's write hello here. And let's use class name. BG red 500. Look, I am not getting suggestions. Wow. But this is working. Why we are not getting suggestions? BGRED I don't know. I have installed extension. I have installed extension. Tailwind IntelliSense This is installed. I don't know. Let's reload once. Reload window. If we don't get suggestions, then we will have to write a little by ourselves. Right? Yes, we are getting suggestions. Very good. Alright. Our Tailwind is working perfectly here. Now, what we have to do? First of all, we have to make a card component. So, let's quickly make a folder named Components. In which we will keep all the components. Although, we have to make only one component. So, let's simply make a card.jsx in the component folder. I had said to name it UserCard. You can also keep a simple card, but it's okay. Alright, this user card has been made. We will make it now, but at least our structure has been made. So let's come here and see if our user card is working properly or not. Our user card has come. Where is it coming from? It is coming from here. So whatever style we will do here, we will be able to see it. So let's quickly make our user card. Some have to be made in this way. So to make it, first let's create a skeleton and after that we'll quickly design it. And if we keep writing Tailwind CSS, then it's obvious that it will be done quickly. So we have to make a card like this. For now, I'll make a card and give some width and height. Okay, this is our card. I'll give some width of this like 20rem. And I'll give height 30rem. Temporally for now. Then I will change it definitely. So, 20 rem 30 rem and give BG. Red 400. Let's see how it is looking. So, I have zoomed. Now it is looking something like this. Ok. Very good. And I have to make a grid here definitely. So, because we are writing like this with Tailwind, so I am writing here quickly. so that I can see. So what do we do to make a grid? Display grid. So here we will write only grid. Our display will be grid. We can mention the number of columns from the grid column. So let's assume I want 4 columns. And what? I want an end gap. Let's give a gap of 1rem. So this is our gap. Okay. So something like this is coming to us. And let's replicate the card. This is the work that we have to do. Let's start making the structure in the user card. First understand how to make the structure. I have already told you this in JavaScript and CSS. So I will tell you once again, what to do here, see how many parts do we have to talk about first, the first part is this one, where we will give a normal height of a box, you can see this box at the back, we have to put an image in it, what did I say, listen to me carefully, listen to me carefully, I have to make a box in this way, let's select a little different color, white color, okay, a box, Where is our pen? Here it is. So, we have to make a box like this. This is our box. In that box, we have three portions. This portion is ours. Okay, let it be like this. This portion is done. After that, there are some portions below. We will see that later. First, we will complete the first portion. So, this is our portion. Now, what we have to do in it? We have to take an image in it. If we make an image anywhere, then obviously, it will come at the top. So, we don't want it at the top. Where do we want it? First, we want it in the center. Horizontally. This is our horizontal line. We want it in the center. So, definitely, we can do it by applying flex here. But, we won't do it like that. Why? Because, we want it a little bit outside the box and a little bit below. So, we can do it in the same way. That is our position absolute. We will take it in the middle and push it down a little bit. So it will come here. What did I say? We will make an image here. This is the image. But we don't have to keep this image here. What we have to do is, we have to take the image from the screen by doing position absolute. And then bring it in the middle. But not in the middle, we have to push it a little bit down. So here it is in the corner, but not in the corner, a little bit down. So we have to keep it like this. So our image will come like this. So let's make it quickly and you will understand. So let's come here in the code. And here the first part will be ours. We will give the class name as height. We will give the width as full. It means the width of the main container, the width of the main box. It will take the full width. And we will give the height as 30%. So, it will take according to the width of the card. For now, let's give 10rem. Okay. And its bg color. This is how it looks like. I will give a little border-radius here. What do we use for border-radius? You must have practiced a little. Here we use rounded. If you want to give 2px, 3px in rounded, then you can give it like this with square bracket. Otherwise, you will get these classes here. If you want to give large border, then you can give large, 2xl, 3xl in this way. So, you can see the border is turned here, but it is not visible here because we have not hidden the overflow. So, not large. Let's give xl. See, it is cut a little more. You can see it in this corner. It is not visible above because this box is hiding it. If I remove it, you will see it. It is visible, isn't it? It is not visible because it came from above. For that, you can do two things. Either give it a border-radius again, whatever we have given here. Or simply hide its overflow and your work will be done. See this. So this is exactly what we have made. Now we have to put an image in it. So let's put an image quickly. Let's put an image quickly. In IMG, let's search for an image here. Image. Character image. Okay. So here we will get an image. Let's take an image of anyone. Let's write a selfie. So a little. You will get a big face. Let's take this image and copy the image address from here. All right. And where to paste? Here. You can download the image and then import it again. I have told you all that. So I put it like this. You see how to put it. And here we write error loading image. If something goes wrong in the image, it cannot be loaded, then you will see the error loading image here. Let's see how it is looking quickly. So, we need a box like this. We need a box like this. We will make its height full. Full means it will fit in the box. So, the box is fit in the box. What we have to do is to bring it in the center. Before bringing it in the center, let's make it a little rounded. Let's make it a little rounded. Then this whole circle will rotate. See, the whole circle has rotated. We will do one more thing. This was a square image, so it looks like this. If it was a rectangular image, then it would look a little wrong. Like this is a rectangle image. So if I put this, then it will look a little wrong. So you have to see all these things. As a designer, You have to see all these things. See, it is in rectangle. So, how is it looking? It is not looking round. So, what we can do for this? For this, we can do aspect-square. We will do aspect-square. So, see, it is a little stretched. And if the image is of big width, it will look a little sticky. Because we have done aspect-square. So, it is a little stretched to maintain the square. If we cover the object, it will be perfectly covered. What did I say? First of all, I filled the height. Then I thought that if the image is rectangular, then it will not be round. So, to make it round, I said to square the aspect. This will maintain the square aspect ratio. Now, it can do anything to maintain the square. It can do chips, it can stretch, as it has stretched here. So to solve this I will say object cover. So this will be covered in the circular you are seeing. Ok, I will do it. See this object cover and here it is completely covered. That thing is different. Its head has gone up a little. If we take a selfie, then it will be fine. Ok. You can mention the rest of the position here. Like there is a position. Something like this happens. object-top object-top is coming from the top and if you don't know what is object-top then you can search the normal css on the tailwind site I told you to read the documentation search on the tailwind site and you will get the tailwind classes ok see here it was coming like this so I thought its face should be visible So, to show the face, what did I do here? I have said object top here. Show me the top portion. What will I do by looking at the middle portion? So, this is the top portion. So, this is our image. Alright. Now, what to do? Now, look here. So, there is a little padding near it. What is there near it? There is a little padding. Okay, I will bring it in the middle first. Then you will know that what to give padding and what to give border. Although, I think padding and border will be used both. Let's put it in the middle first. I will make its position absolute. To make it absolute, just write absolute here. And it will be absolute. It will rise up from its place. Look, it has risen up. And it is looking very dirty. Okay. So, we will do one thing. We will make its parent position relative. So, it will remain inside it. Now, what happened? I have told you all this. If this is not coming, then why? How did it come in react? I have done absolute, so I thought it will rise from the page. Now it has risen from the page and has spread somewhere above. What I wanted was that the parent container of this, whose height is 10rem, should remain inside it. So I have to give it a position relative so that I can tell that it should remain inside it. Okay, so this was also before, what did we do extra now? Now we did extra that I lifted it a little bit from my screen. Now it is not visible, but it is lifted, assume. So it can move here and there. I can move it here too, I can move it here too, I can move it down too, I can move it down as much as I want. Right? We could only do it here and there with the flag, up, down, in the middle, we could only do it inside it. But now we can move it here and there and outside it with the absolute. Alright, how? How? How? So see this, this is our image, right? This is the image, right? In this image, I will say that translate from x, x is this one and y is this one. This is y and this is x. So, I need a 50% translate from x. So, I will translate from x. What is 50% for? Is it 0.5? No, no, no. If you don't remember this, then go and see. It's not a problem. It's 50. 50, I believe. No, 50 is too much. So, 1 by 2. 1 by 2. 1 by 2. I just remembered. 1 by 2. Okay? So, 50%. Means, it's in the middle. You can see it in the middle. You can see it, right? Otherwise, you can do this. You can write by yourself. By putting square bracket. You have to write something by yourself. Like 50%. 50% will come in the middle. This depends on you. 1 by 2 means 50% and you can use your unit by using square bracket. I told you this also. Why don't you see it from the start? Now I have to shift down a little bit. Now I have to shift in y axis. How will I do? I will write translate y. If I do 1 by 2, then it will shift below 50%. I didn't want 50%. No, I didn't want 50%. So, I will do 1 by 4. 1 by 4. 1 by 4. Wow, 1 by 4 looks perfect. See this. Okay. Perfect. Now, see here carefully. There is a white border here. Can you see the white border? You will say that its background is white. Let's take another image and see. Let's take an image in which the color is different, like its color is different. You can take more here. Let's take this one. Look at this. It's looking great. Copy image address. Something like this. All right. Wow. Now it looks like a user profile. So what to do in this? If you look carefully, then a little bit in this. How will this blue line come? You can see this blue curve line. You have to put your mind, not much. CSS is also logic. Put a little logic, it will be done very easily. Otherwise, you will think that they will make a flower pot like this, they will put it from below like this. You don't have to do anything like this. Put your mind, it will be a little bit. Look, this is also blue color. This is also blue color. So if I give it a blue border, then only a be visible above. Hey, look what I said here. Look, if I give this image a border, let's say I give it a border of 4. And the color of the border is blue. Blue was 400, right? Give this exact border of this color. Look. Look at this. It has come down, isn't it? Can you see it? What did I say? Give me the exact same color. Otherwise, I'll give you a different color and show you. Look, I gave the border red. So, look, the border has come in this way. Isn't it? The entire border has matched with it. And leave the red, I'll give you green. You'll know better. Look at this. Okay. So, what has it done, Hosea? It has matched the color of the border with this. So, it doesn't look like there is anything in it. It looks like a blue curve from the bottom. We will give the same color border here. If you want, you can increase the width of the border. It looks good. And make it more beautiful. If you look carefully, you will say that there are two borders in this. One border is of white color and the other one is of blue color. So, how will you give two borders? So, one border is done. Now, give some padding. So, space will be created. And give the background color white. Just use your brain. Look at this. What did I say? I said give padding. Give padding of 3. So, look here. A little padding came. Now, I will give it background color. BG color. bg I will give green ok see this can you see I have given a little padding if I would not have given padding if I would not have given padding then it was covering the whole but I have given padding here a little so space came alright very good now the color of padding the color of padding sorry there is no color of padding the color of background I will give a little white a little white I will give a little white ok This will look like this. And the padding of the white color is a little less. So let's give the padding of 1. Let's see how it looks. The padding of 1 looks good. And I believe the border should also be a little less in this. Let's give the border of 4. Let's see how it looks. It looks good. It looks so good. It looks good. It looks very decent. Very good. So, one portion is done. So, you have to make it this way. First, see what things are there, how to style it. That's it. It's not a tough task. Tailwind is also very easy. You have done CSS. Tailwind is very easy. So, now let's make the lower portion. So, do you have to do anything special in the lower portion? Give a heading. Give a paragraph like this. And put an icon. I told you in the last lecture that you will put an icon quickly. So, this is the top part of our card. Now, after this, After this, this is our top part. And after this, we make our bottom part. No problem should happen. Okay, this is our bottom part coming here. We will give H1. And we will give name in H1. I will give my name here. Alright, this is my name. And then here I will give in paragraph I will give in paragraph. I will give full stack developer for now. Full stack developer. Alright. And below that we have to put icons. So now let's see how it is looking. It is looking like this. So we will fix everything. Don't take tension. Actually red color is not looking good. Let's remove red color. And if we remove red color then it will not be visible how much portion is there. Let's give a little shadow. It will be visible then. Okay. Let's give it a big shadow of 2xl. See this. Now you can see that it is looking like a card and also looking cute. So we will do one thing. What will we do? Tell me quickly. First of all, we will flex its display. Why will we flex the display? Because I want it in the center. And flex direction, flex direction, column is needed. You understand, right? Okay. See, by doing column, it came in one line. And I want it in the middle. Because I have done the column in the flex direction. So, it will not be done by doing justify center. It will be done by doing align item center. So, to do align item center, just write align center and it will be done. Sorry, not align. You have to write item center. Ok. You can go to the tailwind site and see. You have two things. Justify content and align items. So, for justify content, just write justify here. And for align items, you have to write only items. Item center and align items will be center. Now I can't see it, so I have to give a little padding from the top. So I will give the padding from the top. How much should I give? Should I give 3rem? Here I have given the padding of 3rem, so it looks something like this. Okay, very good, it looks beautiful. Now let's put the icon quickly. Let's put the icon quickly. So I will make a container for the icon. Icon container where all the icons will come and I will style it by flexing the display. Okay. So where will I get the icon? See, I put one icon, you put the rest. Ok, you can do this much hard work. I will search here react icons. Now to put react icons, I will have to install react icons. So I come here and you have this command, copy paste it. I will simply open it here. And now I don't want to close the project. So what did I tell you to split the terminal from here? And while the project is running, you can also install something of your own. So NPM I react-icons It will be installed quickly, it should not take much time. See, it is installed. Very good. Now what to do? Now we have to put an icon here. We have to put an icon. So I search for a YouTube icon here. We got a YouTube icon. We will import from here. Should I hide it? Okay. So here I have done this import and they are not using it like this. So here is our icon and in this way we use the component icon. You know this much. So here is our icon. See this will be visible. Now in this way I put 4-5 icons as much as in this card. 1, 2, 3, 4. Ok. So 1, 2, 3, 4. Alright. So 4 icons have come here. First of all, I will flex its display so that it comes in one line. And I will give it a gap of 1rem. So it will take some space between us. Alright. What else can we do? And it has done a little smartness. It has given some background padding and rounded it. So I will also do it. There is no problem. I will also do it. I will also do it. See this class name. I will give dg red 500 or 400 and padding should be 3. Let's style one icon then we will do the replicates. And text color white otherwise you will not know that you will get the same. Actually, it is not visible because we have given more padding. So the icon has become so small that it is not visible. So we have to increase the size of the icon. So let's do text 3xl. It is a little visible. Ok. Let's do 6xl here. Yes, now it is a little more visible. So you can see according to yourself what you have to do. Let's give padding 2 here now. So it looks better. And let's do 5xl here. this much is fine and rounded let's make it full this is round round round if we make it 4xl then it will look good looking good looking better and remove this from here ok this is done copy paste this see we have 4 icons And after that, we have to make two buttons quickly. So let's make a different component for the button. It is a similar type of button. So button.jsx rafc. Alright. And it is very easy to make a button. What will we do here? Let's give a class name. bgblue 400. And let's use the button here quickly. We will also make a container for a button. Here will be our button. Alright, our button has come. Our button has come. Let's style the button a little bit. Text white. It looks a little boring. Do the same work in a repetitive way. But you have to do otherwise. Beginners don't understand. Our text has become white. After that, what to do? Let's make it a little bit rounded. Rounded large. This is how we do it. And let's do it with Padding X. Let's do it with 3. It will look good. And let's do it with Padding Y. It looks better, right? it? Okay. Uh, rounded is a little full here. I think. Let's do rounded full. Hmm. This is the same button. Look at this. Okay. This is the same button. And from padding X. So, these are the two buttons that we have made. We will come to the user card and replicate the button. Now, how will we change the title here? Or how will we change the text inside the button? So, there are two ways. As a children, I have not told you that way. So, take it as a proxy and change it. So, we will receive props here. We will send it. We don't do it this way because children are not passing. So, let's make button and self-closing. And here we will send the text from here. And in text we will give subscribe subscribe and message. Subscribe and message. Okay. So, here where? Here. Here we have received props. Alright. So, here props dot text. So this is done. Very good. And in the user card, we will quickly flex its class name. And what else can we do? We will give a gap of 2rem. So let's see how it looks. It looks like this. It is looking perfect. And if you want to make this below, then we will make this too. We will make one and replicate it. You can make the rest according to you. It is your responsibility to change the icon. So let's make one here. Div. Like this. And here you have actually. There will be one container first of all. There are three parts in one container. One part, two parts, three parts. Ok, so this is our container. Let's make one part first, then we will replicate it. Rest, you can change the icon or change the number. Ok, so what to do here? So for the time being, I will remove the icon of a heart from here. I search for heart. And this icon, I will copy it from here in this way. And here I will paste. And I will paste this heart icon here in this way. I will put it, this is our icon, ok, it is in charge, ok, so this is our one icon and just next to the icon, just next to the icon, I will use this fan tag and I will write 60k here, 60k, wait a minute, let me reduce the brightness, the brightness increases when it is charged, 60.4 or whatever it is, I will do it quickly. It looks like this. So what will I do here? I will flex here. I will center the item so that they both come in the same alignment. Otherwise, see how they look. See, it looks a little up. So I will center it here. So it will come in the same alignment. Alright. It looks perfect. and here we will do text excel ok it is looking a little big very good one is made and we will replicate it now one is made ok we will replicate it now one two three three came now we will do the main container work here display flex and item center let's do it in this too so it is coming something like this And we will give a gap of 2rem. Very good. And there is a lining in between. If you can see like this. So, there is a line too. So, nothing much for this. Make an empty div here. In the class name, you give its width 1px. 1 pixel, give full height and give black so you will see this line. I have made a normal line, the width is less than 1 pixel, I have given full height, so it will look a little stretched like this. It is not visible, it should have been visible. Actually, I have to define the height here, I think I will define the height of 2rem. So see, let's do 1.6, it looks better, okay. and make a component of this line below because we have to use the line twice. So, let's make a component. So, rafc and remove this. Remove this. Okay. line. Line and this is our component of the line. Now we will use this line multiple times. See, we have made a small component of a line because I thought it was being used multiple times and it will be used in the same component and not everywhere. So I made another small component inside the same component and I will use it here. In this way, this line is used and I will use it here as well. Now I will change one place and both places will be changed. So here is our line. And we will give the gap of 1rem. So it will be perfect. Ok. And in the line, we will do bg black divide by 20. So you will see a little lighter shade here. Ok. So this is completely done according to me. Now what I will do. Now look carefully here. Now I had fixed the width of the card. What did I say? I had fixed the width of the card. And I had fixed the height. I have removed the width and height of the card. I have removed the width height of the card. So now it looks a little messed up. But the good thing is that it will be arranged according to the grid. Listen to me carefully. I have fixed the width height of the card. If I fix the width height of the card, then definitely I will not be able to make it responsive. I also have to make it responsive. So I will give the width height of the card something like this. So that as it gets smaller, the width of the card also decreases a little. According to that, I will do something here. So let's see what we can do. So, something like this is coming. And this image is looking a little crooked here. This is because I have given 1 by 2 from the translate x. If I do 0 from the left here, then it stays here. If I do 50% from the left, then it is fine now. I have done 50% from the left. And I will do 1 by 2 from the translate x in minus. So, it will come in the center. I have told you this before, I forgot it actually. I was doing this without using left, I was doing 1 by 2 with translate x. What was happening with translate x and 1 by 2? This can go till the center. This whole box is translated according to itself. If the width of the box is this much, then if I translate 50%, then half of the box means this much. 50% and I was thinking that it should come in the middle of the whole, so it does not happen that way, if I use left here, then I will do 50% left or left 1 by 2, not 1.2, left 1 by 2, then it will go in the middle. Now if you look carefully, it was here before, now it is starting from the center, from the 20. I have left from the 20. So here it is going from the 20 and going ahead. Now what do I have to do? Now I have to do the translation of this box, 50, half, I want to bring it in the middle. I don't know if you have understood or not, I have told it in many lectures. Okay, once I erase here and show you. This is our circle. This is our circle. Now if I translate it to 50%. So what happens in the translate, this is the full width of it. If I do full translate, then this much width will be translated further. This much width will be translated further. But if I translate 50%, then this will be half translated. Means it was here, its center will come here. Half will be translated. And if I keep the left at 0%, then it will be here. If I keep it at 100%, then your center will start from here, the center will go out. And if I keep 50%, then your center will start from here, like this. And if I translate minus, then this center will come in the middle. I have told this calculation many times, so I believe you know it. So the best way to do center is to do 50% from the left and do minus translate x to 50%. So you will come to this center. Minus translate x to 1 by 2. So, this will be in the center. Ok. Alright. So, this is in the center. Now, let's fix all these things quickly. So that it looks more beautiful. Ok. Now, I will change the width of the image also. Actually, I will not give the height now. I will do it according to the width. I had given the height full. I will do the width 50% and see how it looks. So, this is a little big. I will keep 40% not 50%. So this 40% looks like this. So this will be small now. So this will also be small. But no, this is not right. Actually, this is not right. I have to give height here. Height full. If I do aspect rectangle then how will it look. Not rectangle, video I believe. Aspect video. So it is looking like this. And now is it responsive? Yes, now it is responsive. So this is more perfect. So I have made its aspect rectangle. So now it will always be in rectangular shape. And on which image it is depending? Image is depending on the height of this rectangle. So if it is small, then the overall width and height of the rectangle will also be small. I have fixed the aspect ratio. So if it is getting smaller, then see the rectangle is also getting smaller and the height and width of the rectangle is getting smaller. Now the height is getting smaller, so it is depending on the height of the image. So the image is also getting smaller, so in this way you can make it responsive. You have to think a little. If you keep it fixed, then there will definitely be a problem. Now what will I do here? Here, all the things of this div are actually fine here. I will give padding-top to be 5rem and class name text to be 2xl. Now let's see how it is looking. It is looking good and font will be bold. And here in the paragraph, we will give the last name margin y of 2. So there will be a little space above and below. And full stack developer, I believe, is fine. It looks so small and beautiful. Ok, let's give space above and below the button. The button we have, this is our button. So let's give space above and below the button, margin y of 2rem. And it looks something like this. And here we have given the padding from the top, we will also give a little from the padding bottom. We will give 3rem from the padding bottom. So this is how the padding has come. So now our card component has been made. Alright. It has become very proper. It is also completely responsive. And it can be made a little more responsive. For example, if I come to this width, I have to reduce the grid a little before 1200 pixels. So I will write here maximum of 1200px. I am telling you that from 0 to 1200px you have to keep grid column 3. Means it should be in 3 columns. From 0 to 1200px it should be in 3 columns. So from 0 to 1200px it will be in 3 columns and after that it will be 4. And I can give breakpoint like I can give breakpoint on 950px. I want maximum of 0 to 950px. Wait a minute, I have written it in the wrong place. Column 3. Here maximum of 950px. I will give grid column 2 here. Definitely I will give 2. So see this. From 0 to 950, 2 will remain. Then after that, it will remain 3 till 1200 pixels. Then after that it will be 4. I give a little more breakpoint. Like after 600 pixels, I make it 1. It will be 1 till the maximum of 600 pixels. Agreed column 1. Okay. So now we will make it smaller. So see this is 1. It is looking nice. It is looking good. And we will give a little padding. Overall it will look better. So, here we give padding of 1rem. So, now see this is looking more beautiful. Ok. It is looking good. Looking good, we have made it responsive. Very good. So you have to think a little bit, how can it be overall responsive. If you go fixing the width and height, then somewhere your code will get spoiled. You have to keep a little bit of logic in mind. And I am also writing CSS after a long time, so see, I am getting confused myself, so definitely you will get it. A lot of things come out of the mind, then you have to see the code base again. Your own code base, which you have made. You have to see that again, that I did it in a good way, this one, I have applied the technique. So, here again you have to apply the same. Ok. So, this is your card. So, our challenge was almost completed. First of all, we had to make the card component. The card component was made. And this third one was completed. We had to make the grid layout. This was completed. And we have used tailwind CSS here. We have not used normal CSS, module CSS or inline CSS anywhere. We have used Tailwind CSS everywhere and we have become responsive. So we tick here what we have done. So we have become responsive. We have used Tailwind CSS everywhere and we will do it further. Here our card component has been made. Very good. Our card component has been made here. Then after that our layout has been made here. Now we have to use the props to send the data. Now see all have the same data. So I will use the props to send the data. So, first of all, you have to use props. Here you have to send props in the key value pair. Take any key of your choice, take any value there and access the props through the key you have given here. So, here I give the title name of this. I have given the title name. If you want, then give the heading. I have given the title. Ok, so I will send the title here as Manas Kumar Lal. Then after that, here is the role, full stack developer. R O L E ROLL FULL STACK DEVELOPER. All right, then after that we can have different different links here. So you can send link one link two in this way. Link one link two link three link four. But now I don't have any link, so I'm not sending it. It will look like this as it is now. You know how to attach link 1, link 2, link 3. You have to do the same work in the same way as you are sending props. This is your homework. You have to change the icon and attach the link separately. We don't have to give any redirection in the button, so we will not send any link here. This will remain as it is. If you want this account, you can send it here. For now, I send only one thing. I am sending like count. You can see here like count, comment count and share count. You can send both of them. I am sending like count here. My main aim is to tell you. Rest you can do. I am sending like count. In the same way you have to send share count and paste it there. In the same way you have to send comment count and paste it there by receiving. In the card component. I am sending like count. 60 points. or 20.3k. This is our like count. Alright. So for one card, I have defined these three things. You can define more things in props. Very good. Now in the user card, I will receive props in the user card. Now take props in this way. So here you will get props as an object. In that object, here props.title, props.likeCount, props.something. You can do your work in this way. And here like will be L capital. Let's keep it small and consistent. I can also show you. If you do CLG props, you will get an object. The one you have sent, you will get it here. See, did something go wrong? Let's reload. I am getting empty. Why? Why? Why? Why? Okay, they are sending it in the first card. So remove it for now. Now you are getting title, role and like count. So you are getting an object. If you want you can do destructure. To do destructure you have to give the exact same. So you don't have to do props, dot, props, dot again and again. So here title and what was our role and here like count. Title, role, like count. So our title will come here. Where? Here. Here comes our title. T-I-T-L-E title. And here comes your role. Role. And here I am using the same thing in all three. Like count. You can use different like count, share count here. And whatever things I have not done dynamically, you can do it. Okay. You have to do the same way as I am doing here. So, see here the like count up came, the name came, the role came. Ok, let's do the image too. Let's do the image too. Why to leave the image? So, let's send the image URL separately. So, in one, I send this image. Ok. Copy image address. Copy image address. Ok. So, here we have two cards. Here I will send the image URL. Image URL. So, For one, this image URL and for one, this one which was here. This. Cut it from here and paste it here like this. Image URL. Ok. Very good. So, if I want to keep it neat and clean then I can keep it like this. And there is one more way, I will tell you that too. So this will be your one component where we have sent the data related to it. This will be your second means basically there is only one component which we are replicating by changing the data. OK. So this is the data of your second component. Alright. And where did this come from? Hmm. This is not needed here. OK. One two three four is the key value pair. Here too one two three four is the key value pair. And we will quickly paste the image URL here by receiving. Image URL. and here we have to do receive image url ok we have got the image url we have put it here alright and from here actually alt has disappeared we will put error loading image in alt so that if the url is wrong then at least we will know that there is some problem in image loading so see here both the images are coming the name is same because we have given the same name if we change it here I will change the like and give it to Muskaan and here muskan is also full stack developer like count of muskan is 60 definitely more than me 690.3k ok so see this is minus muskan both are full stack developer here is this much like count here is this much and ok here in image let's separate a little this is muskan image and this is minus image ok All right. So this is the image of Muskan and this is the image of Manas. Now it looks perfect. Now in this way, you can definitely replicate it here. Your multiple cards will come. Wait a minute. Okay, so in this way. Now you have multiple cards. And this is perfectly responsive. Congratulations, you have made it. But there was an optional work. Everyone must have made it till here. Now, those who have done the work of Jation. Those who have done the work of Jation. They have done a very good job actually. Okay, what was the work of Jation? Actually, I keep watching the video again and again. So, if there is no cut or the charge is not over. So, where did our challenge go here? So this is also done. We have done everything through props. We tick this too. Now this is optional. We have to make a json and map it. What we were doing till now? Till now we were replicating the component like this. And it was not looking good. So we will make a json of data here. So here let json is equal to. Nothing much. There is an array. We map the array. There are multiple items in the array. Right? We have already done small and big projects of the map. So there will be multiple items in the array. Now we will be passing an object in that item. Every user will have an object. Every user will have a title here. Title minus comma lol. Okay. Then after that you have the role full stack developer. Alright. Then after that you have the same thing. This is the same thing from here. Like count and copy this image from here. And paste it here. And put a comma here quickly. put a comma here and remove it from here because it is an object remove it from here because it is an object ok so this is the object of one user similarly you will get the object of another user ok let's replicate this and change the data so who is the other one our second is here our second is Mushkan ok Muskaan is also a full stack developer, his like count is 609.3 and his image was this one. This image was this one. So now see, now we will not have to do all this again and again here in this way. In this way, we do not have to do anything in the user card, I have removed all this here, I have removed all this, I have removed this too, see this. Now I have to use javascript. Why javascript? Because all our data is in this json. We will define all our data in this json. And it will automatically map here. So what we have to do to map? In this way. This is our array. This is our array, json. To map the array, we write the name of the array, dot map. Map is a higher order function. Higher order function means it is taking a function inside itself. This is a function, so we will write it like this. But it is taking a function inside itself. So we will make a function inside it like this. Okay, the higher order function was map, so we made a function inside it. Listen again, listen again quickly. json is our array. We will use the map method. This is the function. It is a higher order function, so it will be taking a function inside itself like this. function. Alright. This is our function. Now we have two things in this function. The first thing we have here is the item. Okay? And the second thing we have is the index. So we don't need the index right now. We will take only one item here and one item is our object. So let's give the name of the object here. You can give any name of your choice. So here we have given the name of the object. And we will be getting this object. And here we will render this card here. Okay? And don't forget to return it carefully. Otherwise, your card will not be returned. So, it will not be visible on the layout. Return it carefully. So, you can see two cards. Both are showing the same card. Because, definitely, how many objects are there in the JSON? One object, two objects. So, how many times will it work? Two times. Basically, the first object will be coming and the second object will be coming. So, your pass has been rendered twice here. But, you have put the same data in the card. You have put the same data. The object that was coming from here, you had to put the data of this object. I will show you by doing CLG object. So the data that you have coming from here. Like here image URL, like, count, roll, title, all this is coming. You have to put this here. So how will you put? Do control X from here. In the title you have object dot title. And here in the role you have object dot role. And in like count object dot Like count. See, I have made the key value pair from here. If there is something else here, the name of the key value pair key, then you will give the same name here. And the name of the key you have given here, you have to keep the same name in the user card here. That's all. And this is ready for you. OK. obj dot. It was an image URL. So you are getting suggestions too. OK. So see, it has come to you. Now you don't need to do anything here. See how neat and clean the code is. You have this much code. And you have this much code for the user card. And this code for the button. Now you have to see how neat and clean the code is. You have to change the layout in app.jsx. You have to see this much. You have to see in the card, you will go from here and debug. If there is any problem in the button, you will debug from here. If there is any problem in the data, then we have kept the data separate. You will debug the data from here. You don't have to find the data in HTML. You will directly debug the data from here. If you want to add more data, you can add more data from here. It will be rendered automatically here. Now you can keep the data in a separate file, like I make one separately in the components here. Let's give some other name, users dot jation. So here we will put this whole in users dot jation. And do you know how the jation file works? There is no need to make this variable in the jation file. Here you simply have to write in this way. Wait a minute. In JSON, you have to give it in this way everywhere. You have to cover it in string. JSON is a little restricted. You must know all this. So do it quickly. Okay. I will increase the speed of this video a little. So you do it quickly here. And why am I doing everything? Remove it. Okay. Very good. And here not single quote but double quote is to be used in this way. It is very restricted. It does not allow you to do anything on its own. You have to work according to the rule that it has made. Otherwise, there will be a problem. I find all this work very boring. Okay, it is done. Very good. And in the end, the comma should not be removed. Otherwise, it will give an error. See, it is so restricted. Remove the comma. Now your JSON has been created. Now you will say that there is no variable. If there is no variable, then how will we use it here? So, this JSON file is different. Now you can import it from here. How will you import? Just like you import an image. And I have told you all this. To import JSON, to import image. Everything. The import one was a different lecture. How to import the component, how to import the image. I told you a lot of things. So, import. Now, give the name of the variable from your mind. So, I give the name users from. From where? Tell me quickly. In the folder of dots less components, one of ours is users.json. So, you have to take users from this. And these users, you have to map here. Now, remove json. J-O-S-N. Spelling was also wrong. Tell me. We will map users here. Wow, our data is completely different in this file, our layout is completely different in this file, our component card is completely different in this file, we have kept the button also different. So, it will be so easy to debug. And our code is so maintainable. Now, it is saying that each child in a list should have unique key prop. Which I had told you earlier. That when you map, when you map, then here a key, unique is to be given. Now, here you see what is unique in your data. What can be unique? So, image URL will be unique in all. Here, make an ID in all. ID12. which will represent unique, because every id is unique, so I made an id here, so don't give the same id, otherwise it will be telling you that it is the same id of two components, so here we will give the object.id, so now, although you can also give the index, here I said that the index is also coming along with the item, so you can also use the index, but again it is fine, So, without any error, in a proper way, I believe we have completed all the things in our challenge. We have done component creation, dynamic work, layout, and this optional production approach that I had told you that you have to do this way, I have also told you this. I have used Tailwind CSS only. No module, no regular, no inline CSS. And here we have made it completely responsive. And it is so responsive that it will not get spoiled anywhere. And if it gets a little messed up, then you fix it. So this is our challenge 1 complete. And here you quickly increase the data a little bit. Give a comma here and increase the data a little bit in this way. So by removing the comma here, now you will see multiple users like this. Did you enjoy it or not? Tell me quickly, did you enjoy it or not? So, I believe you must have enjoyed it. We have kept a lot of things in mind here. We have revised a lot of things here. And a lot of concepts have been cleared for you. So, I believe you must have enjoyed it. Okay? And if... If you were expecting something else, then definitely comment and tell me. Although it's still basic, so what will I tell you in basic? Now we have a lot of things left. Hooks are left, Reactor Autodrom is left. Our first phase is not complete yet. We will go to the second phase. Although I will try to keep speed. But I can't promise. You also know what is going on right now. Okay, so let's meet in the next lecture. Till then, bye bye.