- Podcasts
- ReactJS Developers Podcast
- 5 Mini React JS Projects to Master Conditional Rendering | Practical React Tutorial
5 Mini React JS Projects to Master Conditional Rendering | Practical React Tutorial
ReactJS Developers Podcast
- December 3, 2026
- 49 min
- Episode 18
About this episodeWant to understand conditional rendering in React JS through practical examples? In this episode, we explore mini-projects designed to…
- Understanding conditional rendering in React JS.
- Using if/else statements to control what appears on the screen.
- Applying ternary operators in JSX.
- Using logical AND (&&) for conditional display.
- Rendering components based on user interactions.
- Managing UI visibility with React state.
- Building practical mini-projects using conditional rendering.
- Writing cleaner and more reusable React components.
- Beginners learning React JS.
- Students practising React through mini-projects.
- Frontend developers improving their component development skills.
- JavaScript developers interested in building interactive web applications.
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
5 Mini React JS Projects to Master Conditional Rendering | Practical React Tutorial
Now I am giving you two simple tasks. With a lot of honesty. With a lot of love. With a lot of ease. You have to complete these two tasks now. If you have done it. You will get a proper idea of conditional rendering. In the last lecture I taught you conditional rendering properly. So these two simple tasks I am giving you. It is a basic task. But it is used in every project. So if you have done this. You will get a proper idea of conditional rendering. And many concepts will be clear to you. And if it is not. Then you can try for 1-1.5 hours and then continue the lecture. So, what is the task? First of all, you can see two buttons here, delete and edit. The first task is to make a pop-up. You have to think how you can make single component and use it everywhere. I have made single component here and used it in both. In delete, delete is opening and title and description is also coming. In edit, edit is opening and closing properly. So, you have to think about how you will do it. You have to do conditional rendering. Along with that, you have to make a single component. How will you handle all the things in two places? You have to think about it. You have to think about it. If you want to use a lot of your brain, then you can definitely continue the lecture. If you don't make this task, then you can simply do the other one. The other one is a nap bar. Do you want to make a nap bar? Yes. Using tailwind? Yes. So, tailwind is conditional rendering. Look carefully. This is how it looks on the screen of the PC. How will it look on the mobile phone? This will not be able to adjust a little on the mobile phone. So, how it will look on the mobile phone? You have to think about this. So, my task here is that I am giving you is that as soon as you make it small, you select a breakpoint of 720px. After that, this should disappear completely. Look carefully here, this is completely disappeared. And here is a menu button. Look carefully. This button will disappear and the menu button will appear. So that it remains responsive. As soon as it goes to the mobile view, the menu button will appear. When you click on the menu button, it comes with the animation and the transition from the side. And as soon as I click, it goes back. I clicked and it came. I clicked and it went back. I clicked and it came. I clicked on this and it went back. So, these are two simple tasks that you have to do. And definitely, you should be able to do it. I think you should be able to do it. You should be able to use your brain a little bit. And if you still don't want to do it, then you don't have to demotivate yourself. At least, you have tried it. And then you can continue. And even if you can do it, then definitely, you should see it in 2 acts. At least, you can see if you have made any mistakes. Or if I have made any mistakes. So, you can definitely comment and tell me. So come on, let's quickly complete the task. First, take a pause. Take a pause right here and try it with yourself. And if it doesn't work, then come quickly. So I have made a react folder here, you can make a folder according to you, in which you have to work. So I will come to the browser and search here, and tailwind actually search, because tailwind will definitely style CSS, you will get to learn tailwind. And let's quickly copy and paste here. Open your terminal from control backcode. Paste it. If you want to name it as My Project, then leave it as it is. No problem. Let's name it as My Project. So this will be installed. Select React. Select Javascript. Leave it as No. Do we have to start it? No, we don't have to start it. Ok. So this is done. Let's move ahead. Let's quickly install Tailwind. You are getting the installation process. Install it as per your wish. I am showing you by doing it because if someone is new then they will also come. So here it is being installed and we will copy it from here. And paste it in V.config.ts. Where is our V.config.ts? Here it is. Come here and paste it. paste it and paste it like this. This is done. I have done the same as I have given here. I have not done anything else. And I have to import it here in CSS. So which is our main CSS file? You know it. What is app.css? No, index.css. If you paste it in app.css, it will definitely work. But our main root file is index.css. So we will paste it in this. Ok, now Tailwind is applied. Now let's run it quickly. It will run from npm run dev. Let's come to app.jsx. Let's run it here. Wow, it is running perfectly. And let's minimize it here. And let's clear it completely quickly. From here to here. And remove this too. Remove this too. Alright. And let's bring it to full screen like this. Here our First of all, we have to make a pop-up. To make a pop-up, first of all, let's style the button here. So we will take a button and in the button here, show pop-up will become a button in this way. Our pop-up should be opened by clicking on it. We want something like this, so it is definitely very easy here, we will do the work. Very good. Let's make a component for a pop-up here. Should we make a component and work or directly do it in this? Look, I'll do it in this and show you. Then how to structure in the component so that we can use the same component everywhere. We can use the same pop-up style everywhere in our application. So we'll see that too. First, in this component, we do it in the app component. Let's make a pop-up. Then after that, we'll separate it by clicking on proper logic. Alright. So here, We need to make a pop-up. Let's make a div. And in div, for now, in class name, width 200px and height 200px and bg-red 500px. So, we can see it here. So, what we have to do is, first of all, we have to absolute the position. So that it comes up from its place. And from the top, 0. From the left also 0. So, this is coming here. We need the full width, so we will do the width screen. What does screen mean? 100 VW. Definitely, in CSS, you take the full width by doing 100 VW. Here you will write the screen. This means 100 VW. And if you want to take the full height, then write the height screen. This means 100 VH. If you are confused about the units, then definitely this is the problem of CSS. So, we can see the screen here. Alright, but we don't want to show this screen right now. We want this pop-up to come when we click on the so pop-up. And we will give a cross button here. It should definitely go when we click on the cross. So how will we do it? Now let's see quickly. So for this, there will definitely be a need for state. So let's make a state const pop-up comma set pop-up is equal to useState and by default it will be false. Now we have to do conditional rendering which I have told you in the previous lecture. So how we have to do conditional rendering? We want that when our popup is true then only we will see this whole component. This popup component is our popup. So, I want this popup component to be visible only when the popup is true. It should not be visible when it is false. Now it is visible even when it is false. So, it should be visible only when it is true. So, we will do conditional rendering. We will apply curly braces. We have to use JavaScript. I will write here if the popup is true. And operator, source circuiting etc. I had cleared you in the previous lecture. So, if the popup is true, then this component should be run. It means that if the popup is true then only the whole component will be returned. If the popup is false then only the whole component will be returned. And the concept behind it is the concept of short circuiting. I have told that in javascript and in conditional rendering. I have already told you in the video. So, you can check it out. For now, it is simple. If the pop-up is true, then only this component will run. If the pop-up is not true, then this component will not be rendered. See here, this component is not being rendered. If I make it true, then this component is being rendered. Very good. This is what we wanted. In the starting, we have to keep it false. I want the pop-up to be true by clicking the button. Alright. So, on click. Set the popup as true. As soon as I click on it, the popup will come. Now let's style the popup quickly. First of all, we will give a button in the corner to close the popup. Wow, our pop-up has come. Now let's style the pop-up quickly. First of all, we will give a cute button in the corner so that we can close the pop-up. So here is a... Let's give it a button. And let's see if we have something like a cross in it. So let's see how it is looking. It is coming here. I have to send it in the corner. So how will I send it in the corner? So to send it in the corner, I will also make its class name absolute. And from the top, let's give 2rem. And from the right, 2rem. It will be shifted to the top right corner. See it is coming here. If we do 1rem it will look better I believe. See here 1rem. Now when we click on it. I have reloaded it so it is closed definitely. So if we click on popup then our popup is coming. And as soon as we click on it then our popup should be closed. So it is going to be very simple logic here. You know it is onclick. And here we will set the popup. False. Right? If it is false then popup will be false. As soon as we click on it, popup will be false. If it is true then popup will be false. Now we don't need its red color. We don't need red background. We need some different background. We have given BG red 500 here. Here we need some black and some transparent type. Something like that. Show popup. See our popup is here. And not 20 but 50. Click on the show pop up and it is showing up. It is closing after closing. Alright. This close button is fine but we have to make some layout in it. Let's style the layout. What is the problem with the layout? Div and here Let's give some class name. Width 100%. Should I give? Width full, height full. Full means 100%. So, I have given full width and full height. And I will give BG. A little grey type. Grey. Grey. Suggestion is not getting. My brain is getting bad. Wait a minute. I have to reload to get suggestion. I think I should get the suggestion now. BG Grey. Let's wait a little bit. The suggestion will definitely come. It will come. It will come. It will not come. It will not come. BG Red. Yes, I am getting the suggestion. So, I have to give it in grey. A little bit. Like this. Let's see how it looks. Show pop-up. No, no, no. It looks dirty. It looks dirty. It looks dirty. Not like this, not like this. We have a color picker, right? Yes, we have a color picker. So, I want this color. So, I give this color here. So, to give your own color, you have to put a square bracket here. You can give this color in it. So, this color looks good, right? Very good. But I don't want this full width. I want max to max. Max to max. I want to give max to max width. Maximum width is 20rem. Show popup is 20rem and maximum height is 20rem. It will look like a square. It is coming to the side. If we want to do it in the middle, then how to do it in the middle? Definitely, we will display the parent as flex. item center, and justify will also be centered, then it will come in the middle, see this. Okay, and here we can show something of our own. So, we will increase the width a little, we will increase 40rem. Maximum width means, you are understanding, so much CSS will be clear. Maximum width means, max to max 40rem should be there. I had said that width should be full, height should be full. So, he was trying to be full. He was trying to be full. But I have set a limit that maximum width should be 40rem. It can be less than 40rem, it should not be more than 40rem. So, it will be responsive too. Okay, so as soon as I will make it small, it will be responsive too. See, it can be less, it can not be more. It can be less or not much. Is it sliding? Something is wrong here. What is wrong? What is coming on the side? We will have to see. We will see. Let's style it first. 40rem is coming like this. And rounded large or 2xl. Let's see. So this is good. And inside this, one of our... H1 will be there. Some confirm. And here some warning emoji. You can also put an icon. And here some description will come. Are you sure you want to delete this? And here two buttons will come. div and in div there are two buttons first button and here is our second button in the first button we will get no means you don't want and in the second button yes alright and here class name class name now you can do it so fast see here it is confirmed and are you sure you want to delete this and no and yes is coming so I will flex it item flex and and what else I can do and justify between so it came here and this div which is containing our information I will give padding padding of 5 so it will come here and confirmation I will make its size smaller text excel How will it be? Text to excel. Is the text not being applied on it? Because I have already given a style in the heading. Let's come to index.css. H1. Look, font size is already applied here. So now it's fine. Okay, in to excel and paragraph, let's enlarge the text. and give margin y of 5 so something like this is coming and we can do one more thing we can flex its display and make item center and justify center and flex column so something like this will come ok this much you are getting normal css So this is what we are getting here and we can do one thing in this. We had given bit bin, right? Normally, we give a gap of 10 here without giving bit bin. So this will be something like this. Yes, no, yes, no, alright. You can change the color here. For example, you give the color of this BG tomato. Tomato, alright. And here you give the color of BG green. 500, see how it looks, the color is not being applied here. So here again they must have given the color of the button. Where is it? Here it is, they have given the color of the button, I will remove it and here it has been applied, very good. Okay, and here some color is not coming, so we will have to give color here again. Class name, okay, the class name has been given here before, so here what BG should I give? We have copied this color. So, we have to give class name here as well. No, this is not the color. Let's change the color. Click on the show pop-up. This is our pop-up. Clicking on the cross button is our pop-up. Now, our pop-up is definitely made. But I want this pop-up to be made. You can use this same pop-up everywhere according to you. For example, I am clicking on the show pop-up and it is confirming that I can change this. I am asking here, are you sure you want to delete this? I am asking here, are you sure you want to edit this? And you can perform your action on yes or no. And it will definitely cross on the cross button. So, how will you do this? So, you can also do this. You will have to put it in a separate component. This is the whole pop-up. I will cut it from here and we will make a component popup.jsx rafc and here I will put this entire popup no problem should not happen should not happen and I will put this state here for now although state will have to be made outside ok I will tell you why it will have to be made outside I will tell you now so this is our popup and Remove this and put the pop-up component here. This is the pop-up component. We have used the button here. We are doing the set pop-up here. We have used the pop-up here. We have used the button here. We have used the button here. We are doing set pop-up here. And we have used pop-up here. Are you doing set pop-up here? Yes, we are doing set pop-up here. So we will have to make this one outside. We have to create our own state according to each component. So that when we click on one button, the pop-up will be related to it. When we click on the second button, the pop-up will be related to it. So this is what we want. So how will we do this? And I hope that you are making all the projects from the beginning. So it will be clear that where to make the state outside, where to make it inside, when to do what. If I make it here, then both set popup and popup can be done here. But here we are not getting set popup. How will we set popup from here? If we click the button here, then there will be an error here. Because we don't have set popup. So we have to make it here in this way. And what can we do here? We can pass both set popup and popup here. Isn't it? Definitely, we can pass it. So, pop-up. Okay. And set pop-up. We will pass it like this. As a props. And we will receive it as a props. That's it. Pop-up. Set pop-up. Very good. Now, we should do our proper work. According to me, we should do it. So, let's come here. Let's reload. Show pop-up. Pop-up is coming. Let's cut it. Pop-up is gone. Very good. So, this is done for one button. See, we have made a pop-up and we have given a pop-up here. Okay, we have made a component and used it. Now, let's replicate one more component here and see if we are able to use this component in any other. Suppose it was for delete. Let's try to make one for edit here. By changing the information. Edit and here I give delete. Clicking on delete, the same pop-up is opening. Clicking on edit, the same pop-up is opening. Look carefully. Here is the same state. And both of them are working on the same state. Can you understand what I am saying? Here is the same state, both are working on the same state. Okay, one minute, I will clear you now. Let's change some information here. Like I take the title and description separately here. Title, description, I take it separately and here our title will come. Title and let this icon remain here. At this place. Let this icon be. Our title is here. And here will be our description. Description. Alright. Description is here. You can do as per your wish. As you are sending all these things. You can also pass the function of yes or no. I have told you how to pass the function. Ok. So, we are sending the title description. Here also we send the title description. We pass the title. Delete. And we pass the description. In the description. Are you sure you want to delete? Oh man, delete this. And let's arrange it a little so that it looks good. The readability of the code is very important. So format and this pop-up will also come as it is here in this way. And here too, our title will come, our edit and description will come. Are you sure you want to edit this? Okay. You can do it according to your use case. I have made two different ones here. So this is our edit. And this is our I am telling you how you can use the same pop-up. Now if we come here and see, as soon as I am clicking on the delete button, our edit pop-up is opening. And even if I am clicking on the edit button, the edit pop-up is opening. This is happening here because of the same state. We have given the same state and this pop-up is given here first and this pop-up is given at the last. So the one given at the last is coming to us. If I do this pop-up here at the last, delete one, then you have to see carefully here as soon as I click on delete, the delete one is coming. And as soon as I click on edit, the delete one is also coming. So definitely you have to change the state here, you have to make your own state for both. Only then you will be able to use both here in a different way. So here we have given its pop-up name, let's give its edit pop-up name. Edit pop-up and set edit pop-up. So here our edit pop-up will pass. And here is our set edit popup and here is also our set edit popup. Now see carefully, as we are clicking on the delete one, our delete popup is opening and if we close it, then the delete popup will be closed. And as soon as we click on the edit one, our edit popup is opening and our edit popup is closing. So, this way we can use the same pop-up in multiple places. So, try to understand what happened here. Here we made one pop-up and one pop-up component. We tried to use it twice. But when we were working on a single state, then definitely the last one we were writing was overwriting the old one. Because we are working on the same state. We are working on the same state here and opening it. And we are working on the same state here and opening it. So we changed the state. So here both the components are behaving differently. They are behaving differently. So this is our popup. It was very easy to make a popup if you have read the conditional rendering. And you must have got the idea of the state. And how to use the same component in multiple places. You must have got the idea of props by sending it. So now our next task is navbar. So let's make the navbar quickly. Let me drink some water first. You also drink water and then make a nap bar. So, let's move on to the nap bar and it is very easy to make a nap bar. So, for that, I will create another folder here. Let's close it and here we have the command. Before tailwind, we will run the wheat one. And let's do project 2 here too. So, this is done. And react javascript no, no. And we have to run the tailwind command. So, where is our tailwind command? Here is the tailwind command. And after this, what things have to be copied and pasted? Basically, we will copy this config.ts here. So this is done here and put it here quickly. Alright, what else do we have to do? And definitely we have to import it from here. We will import this. Close it. src index.css And this is our import here. Alright, we can run it now. npm run dev. Ok. This is our run. Very good. And come here and minimize it. And quickly clean it from app.jsx. Ok. Remove this too. And remove this too. So now what we have to do is to make a navbar. Alright. So let's make a component of a separate navbar. Let's make a component. New file. here in src new file and navbar.jsx rafc and quickly we will make a cheap navbar so what will happen in navbar I will make in three parts first part will be logo and in second part will be some menus we will use anchor tag and here home and about something something something here will be some menus about Contact and service. And after that, we will get help here. Okay, that's it. Now after this, what else do we have to do? Let's take another part here. What can we get in the third part? A small icon will come here. Let's go. Is there any icon like a cart here? Let's take the cart icon here. put it in the span tag and there are two icons here alright so this is our navbar we will style it a little we will not make it so dirty so this is our navbar ok what we have to do here in navbar first of all we have to flex the display and after flexing it will be something like this and we have to do justify between ok justify Again I am not getting any suggestions. What is this problem? Reload window. And justify. Let's write it by itself. Between. Okay. Its width is not full. Width full. I don't know what is the problem. BG red. 500. Let's see. This is what is coming. Okay. So to make it width full, I believe we have to give width screen. Right? And is there any margin margin in this? It should not be. Reset it. Where is this much space coming from? Hmm, there is something around it. Okay, here we are doing the style without removing it. So, remove all this from here otherwise it will be spreading its own raita. So, remove all this. Now we have to create the style by ourselves. So, it is fine now. So, if I do its width full now then I believe it should work. Alright. So, something like this is happening here. And let's make the background black. It will be better. Okay. So, let's come to index.css. And bg. Let's give it black here. Black. And I don't like too much black. Let's give it a little bit like this. Okay. It's looking good. It's looking good. And we will make the color white. So we can see here. Look at this. Very good. Here we will give the class name. Text we will do 2xl. Font we will do bold. This is our logo. This logo is working for now. Rest you can style it according to you. And here we will give the class name as flex. And we will give the gap as 3xl. And items will be center. Very good. Here also we will center the items. So, it is looking very nice. Not too much, but it is looking nice. We will give padding x of 1rem. So, it is looking like this. And padding y of 2rem. So, it is looking like this. And bg... Let's try LightSeaGreen. LightSeaGreen. Okay, we have given BGRed. Remove Red. Try LightSeaGreen. Why color is not being applied? Why? Why? Why? Why? Why? Is it not being applied because of what we have done? In index.css. Hmm. Because of this, it is not being applied. So do one thing. Look at this color in the body. This should work perfectly. Very good. Ok, so this is our new bar and ignore all this, whatever styling is there. Let's learn logic while ignoring a little. Our main importance is here. So here I make the text large. Here the text is large and I will make the gap from 3 to 5. So let's make it from 5 to 9. It is looking very better now. And let's make this style a little bit. Class name text to excel. Ok, and... flex-item-center-and-gap-pipe. So, this looks like this. Now, we have to make it a little responsive. So, how will we make it? Look carefully what to do. As it is small, after this much, after 720 pixels, we will turn this one on display. Okay? So, maximum of 720 pixels will be seen. After that, it should not be seen. Right? Or we can do this that minimum of Minimum of 720px? No no no no. We will make hidden on maximum of 720px. Alright. So, we can see here now. And our display is hidden here. So, I want to say that keep the display hidden from 0 to max to max 720px. Make the display normal as it grows. So, the display will be hidden from 0 to max to max 720px. It will come as it grows. So, this is done. Now, where to show it? So, what we have to do in mobile? In mobile view, we have to put a menu icon here. So, we will put the menu icon here. Put it here. Put it next to it. Put it here. So, we will get a menu icon here. Will you get it in emoji menu? No, you won't get it. Will I have to put the react icon? Let's put the react icon. React icons and come to the react icons. Now we will have to install it definitely. So take these react icons from here quickly and by splitting the terminal, install it quickly and come here and search the menu menu. Where is the menu? Which one should I use? Which one is looking good? Let's use this one. It looks unique. Import it here. And how to use it? Like a normal component. You know this. So let's use it here. No problem. See our icon is here. Close it. Very good. Kill it. Minimize it. Alright. Our icon is visible here. So, this icon should be visible in mobile view only. It should not be visible after that. So, I will put the same media query here also. Not here. Here. Where? Remove this span. There is no need of span here. I will put the same media query here also. So, what will happen with this? It's a little bit wrong. We don't have to use the same media query. Basically, it should be visible in the mobile view. We have hidden it in the mobile view. It should be visible in the mobile view. Okay, so we will min it instead of max. So, it will be visible in the PC. Meaning, minimum of minimum. As soon as you make it smaller. Minimum means, at least 720 pixels. It won't be visible to you. We have hidden it. So, it won't be visible to you until 720 pixels. If it is smaller than that, it will start to be visible. Minimum to minimum it will work till 720px and maximum means it will work till max 720px. Minimum means it will work till minimum to minimum 720px and after that it will not work. So we kept hidden till minimum to minimum 720px so it is hidden till minimum to minimum 720px and after that it came and that one became hidden. Because we have set the maximum there. Alright. So, this is our order. Do one thing. Increase the text a little bit. Make it 2xl. So, it will be a little bigger. And... It will not be bigger. Why not? Let's make it 3xl. It is a little bigger in 3xl. Let's make it 4xl. It is a little bigger. Very good. We have to do something by clicking on it. We have to bring that which is hidden from the side after clicking on it. This. We have to bring this 5 by 5 from the side. So, we have to style it before the side. So, let's style it. This will be for mobile view. This is for mobile view. So, to keep it in mobile view, we will absolute its position. Why will we do absolute? Because we want it to fly from its place. And for now, let's make it BG red so that we know in which portion it is coming. So, what we have to do is screen its height. I want to take its full height. Is the height of the screen the same? We had to take the full screen, right? Don't do this, man. Okay, let's see, let's see, let's see, let's see, let's see. We haven't done anything here. Have we put any restrictions here? Okay, give the full height here. Even then, I don't think it will work. There is no need to give the full height here. Its height should have been the full screen. button is not coming, why? and we will give width 20rem ok and we will do one thing remove this from the starting style absolute height screen ok width 20rem flex and flex column very good so how is it coming? how is it not visible? let's make it bg red so it looks something like this here What is the problem with this? What is the problem with this? All these things are not visible here. Tell me what happened to this? Okay, zero from top, zero from left. So, this is our top-0, left-0. So, the position of this should be here. Otherwise, it will be coming from a little above. We were not giving this here. So, this was the whole thing but it must have slipped a little above. So, I said take 0 from the top and 0 from the left. Start from the top-0, left-0 and start from here. It was starting from the top and I said start from here. So, it has come here now. Let's style it very well. So, what should we give its BG color? Give black. Remove the red. We have given black. So, it will come from the side like this. It should come with the animation. Shall we style it a little first? Let's do it. So, we don't have to do much. What should we do here? What should we do? Here we have given the flex. We will give the gap of 5. So this is how the gap will come. And let's style it a little. Let's see what's coming here by giving it BG red 200. Something like this is coming. Alright. We will give padding of 5. So this is the padding of 5. Okay. And flex item center justify center. Alright. So this will come in between. And we need the same style in all. So we will apply in one. Actually no. Let's change it to black. A little bit of this color here. So now look, it is coming here properly. And remove all this. Replicate this. 1, 2, 3, 4, 5. Give as much as you want to give the menu here in this way. All of you are coming here. Very good. And here you have to give a button to close. Ok, so give me the same button that we put in the navbar, then we will copy paste the same button here. Sorry, not in the navbar, but in the pop-up. Here is the pop-up. We put this button in the pop-up. We put the same button here, we stick it quickly. So this button came here. Ok. And we don't need on click right now. Remove it. Alright. So see here, it is coming to our side. Very good. We will do one thing, we will give it a little padding of 3. So it looks like this. And we will make it rounded to 2xl. Rounded to 2xl. Very good. And we will slightly scratch this whole portion from above. Shall we scratch it? It will be better to scratch it a little, I believe. So if you give margin from top then it will automatically come down. So you can do style according to you. UI designer's work is to make the style. You just have to see and code to make the style. Don't think about what style you want to make. So, I don't want this to be seen in the starting. It should not be seen in the starting. So, I will definitely make something like this. Our mobile view will be false in the starting. MobileView is equal to useState and false. Alright. So, if our mobileView is true, then only we should see this mobileView. And actually, if we give it directly like this, as I show you, if our mobileView is true, then only we should see this whole thing. If I give it like this, then it will come without animation. See this. First, let's come to mobile. As soon as I click on it, nothing happens. To do something, you have to do something here. So you have to put onclick here. Onclick. And set mobile view to true. Set mobile view to true. Alright. As soon as you click on it, you can see that it has come from the side. But there is no effect. There is no effect. Let's put onclick on the button here too. And here set mobile view, false, alright. So, as soon as we close here, it is closed. It is on, it is closed, it is open, it is closed, it is open, it is closed. But we want it with animation. So, we will not do this. We will not put it directly here in this way. We can do something like this here. We can do something like this here that in starting, Let's do a little translate like this. Let's send it inside. And as soon as the popup is true, we will bring it out. With animation. How? See here. What will I do? I will do minus translate x. This is y and this is x. So, from minus translate x, I will show you 90% for now. So, in 90%, see it went inside. If I do 100%, it will go inside completely. See, this is 100%. It went inside completely. I don't see it. So, what I want is that as soon as our popup is true, when it is true, first I will do CLG, mobile view, so that we can know whether it is true or not. Let's reload. And we can do one more thing for now. for the time being. Let's do not of mobile view here so that true and false remains the same. So, as I am clicking on it, see, it is true. So, what to do when it is true? Translate it back to normal. Make it zero. But with animation. With animation. Okay. So, I will have to use the template literally here. So, I will put the syntax of JavaScript in this way. And here I will use backcute. And here some This way I can write Javascript. So I have to do something if my mobile view is true. And if it is not, then I have to do something. So we will use ternary operator in this way. If our mobile view is true. So, if our mobile view is true, then it should definitely be visible. Okay. So, if it is not, then it should not be visible. And if it is, then translate x to 0. Otherwise, here if mobile view is true then translate should be normal and if mobile view is false then I will send it inside the screen as well. I will translate minus 100%. So, this whole thing will be shifted to minus 100% in X. Alright. So, look carefully here. As soon as I click, it went inside. As soon as I click, it came out. But it is not coming with animation. But now I can apply animation. Basically, I can apply a little bit of transition here. I will give transition all and duration 150. So, look carefully here. Wow! It is coming with a little bit of animation. If I increase it a little, 300, then now look carefully. Wow, it's looking good, isn't it? I like it. It took a lot of hard work to make it. If you haven't done it, then definitely you won't like it. Do it with your own style. I am telling you the logic of how you have to work. Okay, look at this. It's working well, isn't it? It's fun. So just make it this way and keep ticking like this. It will be fun. It's really fun. So this is our map bar and in mobile view it will be visible like this. As soon as we do this, this is gone but this is not gone. You can also do this as soon as the size of the screen is large. You can also do this. You can also do this. So you can apply that logic here. Basically you have to apply the same logic. Sorry, minimum of 720px. After that you have to make it hidden. So, it will work properly. There is no problem. Your mobile view is coming like this. And your PC looks like this. So, did you enjoy it or not? Tell me this. Otherwise, you can make the whole application like this. You can complete it. So, we did two things. First of all, we learned to make pop-ups. These are small things, but when you get to big applications, then this is not coming. Then what will you make big applications? Pop-up is a basic thing that we use in almost every application. You open any application, open GitHub, open anything, then you see a normal pop-up. So, you have learnt how to make pop-up. Then you have learnt how to do conditional rendering in navbar mobile view and bring and sell sites with animation. So, these are the basic things. If you have got these, you will be able to make big projects in the future. Which we will definitely make. We will read APIs and learn some good concepts. So, we will definitely make. And we have not done routing yet. So, we are on multiple pages. So, we can't go now. We will learn how to create multiple pages, how to do routing, we will learn that too. We have to learn a lot of things. For now, that's it. We will meet in the next lecture. Till then, bye-bye and keep on reading.
