1:35 - IF/ELSE 5:07 - Element Variables 7:06 - Ternary Conditional Operator 9:20 - Short Circuit Operator
@morhaham66094 жыл бұрын
For anyone who wonders why can we put jsx element inside a variable without it being a string, it's because jsx elements are just wrappers for function calls. so: let message = hello is the same as: let message = document.createElement('div'); message.innerHTML = "hello";
@animeshkumar95932 жыл бұрын
I think this is partially correct. My guess is that it compiles to: let message = React.createElement('div', 'hello');
@justash123 Жыл бұрын
ooooh thank youu i always felt weird typing it but now i know what it means :D
@harshitsen54793 жыл бұрын
After going through so many different paid and unpaid tutorials, I can this one is the best among all.
@sardorbekaminjonov90754 жыл бұрын
Thank you for the great full course Vishwas bro. I have tried to explore all of the popular tutorials on KZbin. Almost all of these videos do not attempt to provide full instructions. They just cover the basics and say if you want to get the full tutorial click the link below and get it with a discount. So it is a sorta advertisement. But your course is better than theirs. Even Mosh Hamedani's react course cannot provide as clear details as yours can. I APPRECIATE YOU BROTHER. THANKS FROM UZBEKISTAN.
@chiragparyani4623 жыл бұрын
Thank you so much! You're an inspiration, I follow your tips, tricks, and suggestions wherever applicable and feel grateful for your presence on KZbin!
@toannew4 жыл бұрын
0:35 frou kinds of conditional rendering 4:40 JSX is syntactic function of ... 5:10 2nd approach: element variable approach 7:58 3rd approach: ternary condition operator (recommended) 9:10 4th short-circuit operator approach (recommended)
@noblepolygon86945 жыл бұрын
I literally watched the first 3 minutes of your video and was able to write my first if/else statement in react...thank you!
@mycourse37542 жыл бұрын
For those who are watching this in 2022 and are unhappy that Vishwas is using classes instead of functions, you can code along using functions. make sure that instead of creating a constructor with this.state={someProperty: "someValue"}, you just create a useState hook like this: const [someProperty, setSomeProperty] = useState("someValue"). Make sure you import {useState} from 'react'. Also whenever Vishwas is using this.setState("anotherValue") to change this.state, you simply uset setSomeProperty("anotherValue") and the state/someProperty changes. And last thing I want to mention is you don't need render (), just return.
@ketankumar56892 жыл бұрын
Vishwas has also taught React hooks though in the later part of the series..
@m_abosalem6 жыл бұрын
you make complex stuff, very simple , thank you.
@fennecLens5 жыл бұрын
this guy is really doing great things..am i right???
@m_abosalem5 жыл бұрын
@@fennecLens Of course you are right, hope to complete the series
@mareboinaravi52723 жыл бұрын
00:24 - different types 00:35 - If / Else 05:07 - Element Variables 07:06 - Ternary Conditional Operator(? :) 09:20 - Short Circuit Operator(&&) Thank me later.
@nguyendat42754 жыл бұрын
The best teacher i've ever seen.
@SaurabhR7774 ай бұрын
00:05 Conditional rendering in React allows showing or hiding HTML based on conditions. 01:39 Adding conditional rendering in ReactJS 03:12 Conditional rendering in ReactJS with if-else statement 04:49 Conditional rendering in ReactJS using if-else statements and element variables 06:26 Implement ternary conditional operator for simpler JSX rendering 08:00 Conditional Rendering in ReactJS using ternary operator 09:19 Conditional rendering in ReactJS using short-circuit operator. 10:38 Four approaches to conditionally render UI in React
@sandeepkosta57504 жыл бұрын
Sir this react series is best series in KZbin now. thanks a ton for your effort.
@elchino76724 жыл бұрын
This course is unbelivable. It worth a lot
@noureddinezekaoui45463 жыл бұрын
Creating a new file in the components folder every time we switch to another concept is just an amazing choice to keep track of our previous work and come back to it later if we need to! thank you very much for the amazing content. keep it hight and up !!!
@mihajloilic58364 жыл бұрын
Hey dude, I am very happy about this your tutorial! :) You helped me to find a way to solve some of my own ideas in coding in some advances from the previous lessons. GREAT JOB!!! (Y)
@AAKSHAS3 жыл бұрын
1:33 - IF/ELSE, 5:05 - Element Variables, 7:07 - Ternary Conditional Operator, 9:22 - Short Circuit Operator
@RoadsInCanada4 жыл бұрын
Dear Vishwas, Hats off to you for all the video tutorials. I've learned a lot from this channel. Keep up the good work. 👍
@unknowuser26014 жыл бұрын
old but good, You guy make my learn so easily ❤️❤️❤️
@softwaredevnk1664 жыл бұрын
You are an amazing tutor
@lathagm666 Жыл бұрын
completed video 16. Thank you 🙂
@MarleySkunk3 жыл бұрын
im stuck in vanilla javascript... but this makes sense much much more
@dcombsdotio86624 жыл бұрын
This is incredible content - thank you for all of your hardwork in creating such an easy-to-follow tutorial!
@burhanali91173 жыл бұрын
Saw a free react course... Here goes my subscribe
@HussainsTechStack4 жыл бұрын
return this.state.isLoggedIn && Welcome Logged || Guest Please add || condition, so that it will have both condition which is better approach
@nogafouz21742 жыл бұрын
reallythanks alot you have excellent way to explaine
@alejandrourbina59284 жыл бұрын
¡Amazing! It has helped me a lot, thanks.👏🏻
@habamoise47712 жыл бұрын
Awesome very good explanation, Thanks
@vaibsify3 жыл бұрын
awesome explanation 🙏
@laharinamala83735 жыл бұрын
Extraordinary explanation , thank you Sir.
@MuhammadAhmed-wb2sq3 жыл бұрын
Thanks for the video. Really helpful
@VishalSharma-rn7mt4 жыл бұрын
Awesome explanation
@ai.2014 жыл бұрын
Better then any paid course
@timbootcamp89433 жыл бұрын
I wish that would be more with functions than classes :D
@lijojohn62735 жыл бұрын
render() { if(this.state.isLogedin){ return( Welcome Lijo) }else{ return ( Welcome Guest) } This is correct format
@den_36965 жыл бұрын
You can also: ( this.state.condition && outcome A || outcome B ). Or : ( this.state.condition ? outcome A : null ). Not really important, in general these operations do the same thing, just good too know that.
@metizdev79453 жыл бұрын
Thanks!! Vishwas. I think it's better than paid...
@sukhesh10004 жыл бұрын
Hi bro, your tutorials are really helpful for learning ReactJs. Thanks a lot for your help
@SharpalloSharpallo2 ай бұрын
it is very good tutorial
@poornachandrag64073 жыл бұрын
Clean and clear better than paid tutorials
@Salimansasili Жыл бұрын
nice tuturial
@candidfarmer4254 жыл бұрын
Man, you are awesome. A terrific tutorial indeed. Love you buddy!
@prisinha3 жыл бұрын
10:00 Short Circuit Operator double ampersand operator
@kartikthakre82733 жыл бұрын
U are doing grt sir...can you tell me which snippet you are useing for code in react
@ioannisventouzis4 жыл бұрын
The tutorial is super. My only concern is related with return statements in the render method, it is no clear when we use parenthesis, when we use curly braces and when nothing. For example in this video when element variables used as an option, the {message} variable can't used without div's, this is strange because the {message} is already included in div tags at the if/else statements.
@azo95923 жыл бұрын
I know this is a relatively old comment but I'll just input what I understood so that it might give others an idea. Regarding the element variables method, remember that returned JSX elements always have to be enclosed within a single tag (usually div). In the example code the final message variable returned does not actually require an outer div tag before returning because it is storing only one tag inside, but if the message variable stores multiple tags like maybe a div tag and a button outside the div, then enclosing the message variable within an outer div tag before returning ensures errors do not happen. Regarding the return statements, we use parenthesis when we have more than one executing statement. So if you are using Ternary operator methods, the whole a ? b : c or a && b are single executing statements and hence do not require parentheses, whereas each JSX tag are individual executing statements so better to enclose them in parentheses if you have more than one JSX tag. To avoid confusion you can opt to use parentheses all the time.
@mamunethan13563 жыл бұрын
Love from Bangladesh
@jakubgadzala74743 жыл бұрын
By now, I already love welcoming Viswas 🤣
@mihajloilic58364 жыл бұрын
Is it ok to use first/second approach? I really don't respect 3rd and 4th and never used it before, I should get familiar with it through time.
@vignesh76092 жыл бұрын
Is there any difference other than the syntax ? // Type3: Ternanry Operator return this.state.isLoggedin ? Welocme Vignesh : Welocme Guest // Type4: ShortCircuit Condition return this.state.isLoggedin && Welocme Vignesh || Welocme Guest
@questreal58124 жыл бұрын
How is he immediately able to change the closing tag to an auto-closing tag. Like to . Is there any keyboard shortcut for this?
@moinakhter24745 жыл бұрын
Your explanation is just amazing Sir :)
@moderncloth4 жыл бұрын
I love you, Vishwas.
@lasithadulshan73573 жыл бұрын
Thank you .. Good Job
@Naveen-xz6ml4 жыл бұрын
This is just awesome buddy. Needed to let you know that you have saved the day for me
@marypaul96273 жыл бұрын
You are tutorials so good,why are you not posting in udemy so we can buy from you
@obinna_ac28402 жыл бұрын
thank you so much
@sajalsuhane864411 ай бұрын
in case of short circuit approach how can we print something in UI if the first condition is false
@conaxliu96775 жыл бұрын
8:26 What key was pressed to format the code?
@conaxliu96775 жыл бұрын
@Gabriel Daniluk Thank you. :)
@sanjayjoshi57784 жыл бұрын
hello sir what is container and presentation component
@wilghensantos3 жыл бұрын
this is great. I only wish this can be updated to react hooks.
@sanghamitragupta97603 жыл бұрын
He has a course on React Hooks as well
@Aditya.Santra3 жыл бұрын
Amazing Video
@pankajxkumar2 жыл бұрын
why did we use return {message}, not return {message} ?
@20skidscartoonshows24 Жыл бұрын
Becoz message variable holds the result of both the cases
@AhamedKabeer-wn1jb4 жыл бұрын
Thank you
@yazanalmatar89485 жыл бұрын
I've noticed that throughout the whole course you've never used a semicolon to break your statements... I wonder if it makes a difference and why would we use it sometimes? thank you
@yogibaba60085 жыл бұрын
Java script treats every line break as an "implicit" semicolon. This is called java script "automatic semicolon insertion". In most cases new line implies a semicolon but every new line does not mean a semicolon. Hence only seasoned developers should omit semicolon as they are aware of its pros and cons.
@SheshagiriPai3 жыл бұрын
We MUST use it for CSS in javascript.
@ekinsuflashege24024 жыл бұрын
bu güzel anlatım için çok teşekkür ederim. ingilizce bilmediğim halde yinede anlıyorum. sizin gibi değerli insanlara ihtiyacımız var.
in jsx (return) part - can't write if/else but in render method outside jsx, can write if/else, variable decla&usages, ternary operator, logical && - to conditionally render UI in react:
@richardtbohnen5070 Жыл бұрын
Its so weird that we can't use `if...else` but can use ternary.
@wanishoaib_2 жыл бұрын
This stuff cannot be nested. It has to be toplevel inside the return statement.
@anas20046 жыл бұрын
nice tutorial
@zainabideen81443 жыл бұрын
How can we return welcome guest with the fourth approach?
@shivamyadav48462 жыл бұрын
can we get code snippets for every lecture ?
@lincolemos5 жыл бұрын
I'm coming from Vue/Angular. I wanna kill myself after discover how React manages conditional rendering. I'm dead.
@LogeshSLohit5 жыл бұрын
Why man?? In Angular, we have coolest directives , right;) Live with that
@dawoodchaudary87364 жыл бұрын
fuckin right i thought i should give react a try i am from vue background and the way react handles iterative elements and conditional rendering its disgusting
@KanecoV4 жыл бұрын
@@dawoodchaudary8736 Does that mean its a lot harder?
@dawoodchaudary87364 жыл бұрын
@@KanecoV its a bit different in a sense but you get hold of it after working in it Not harder but comparing to Vue .React conditional renedering and iterating syntax is inferior 😂
@ahmadsaleh78873 жыл бұрын
I totally agree. Angular is way more elegant but I have to learn this because unfortunately it's more popular in the industry
@rahmanrio71944 жыл бұрын
How can I use this kind of condition inside map function ,it does not support inside map .
@bhojakrahul58804 жыл бұрын
how to set render condition in my form is data is not there see "add button" and data is there in databse see "update button"
@mrrishiraj882 жыл бұрын
Good day wishes
@michaelrooze2784 жыл бұрын
But how does the component know if its logged in or not?
@mohammadqaderi89764 жыл бұрын
in angular we just use *ngIf within the element haha
@muaazhammad44463 жыл бұрын
yaa and in Vue just use V-if, don't know why react is so complex for conditionl rendering
@muaazhammad44463 жыл бұрын
Why does React don't have directeve like v-if or v-show to conditionaliy render data just like in Vue ???. it is much simpler and easer
@khusanmeliev2 жыл бұрын
but if else it also works in jsx
@luismendoza84284 жыл бұрын
if state changes after initial rendering
@meidymahardika64355 жыл бұрын
what is your plugin in mnt 8.25 for complete your coding
@noorbohsas4895 жыл бұрын
amazing ! what's the name of the fourth approach again?
@syntaxcake45455 жыл бұрын
Noor, fourth approach is short circuit operator
@shushmapatil5 жыл бұрын
At 8.29 you adjusted the code, what is the shortcut to do so?
@HPec-ax3 жыл бұрын
i guess its code formatter prettier
@mareboinaravi52723 жыл бұрын
It's VS Code extension
@milanpoudel37375 жыл бұрын
./src/components/UserGreeting.js SyntaxError: C:\Users\Dell eact app\hello\src\components\UserGreeting.js: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (5:2).....What kind of error is this?
@abhijeetjadhav26064 жыл бұрын
@milan poudel : you get error because you missed to extend it from component Write class UserGreeting extends Component {} instead of class UserGreeting {}
@eurythmia98404 жыл бұрын
thank you!! great tutorial series!!
@lopyus5 жыл бұрын
I found another way to this Welcome {this.state.isLoggedIn?"Ashish":"Guest"}
@9a56mahabirjaiswal92 жыл бұрын
please update it usi g functional component ,It's becomes too difficult to understand
@jagdishshetty47825 жыл бұрын
Great basics explanation !!! Thx !!!
@andy.n35 жыл бұрын
Thanks!
@Chauhannitin3 жыл бұрын
return message This is also enough
@burhanali91173 жыл бұрын
it will be great if you upgrade your course to react 2021 you surely will get lots of views
@noordinabdulkadir3514 жыл бұрын
going through this playlist like snacks
@shaheedk-sm7ho5 ай бұрын
is your name vishwas?
@shoaibamin43424 жыл бұрын
@vishvas i am very thankfull to u. greate job
@ameetshrestha64245 жыл бұрын
What theme are you using for VS Code Editor? Really loved that Theme..
@AM-ey2vn5 жыл бұрын
Should be the default one, at least its for me
@deepikasrinivasasharma74814 жыл бұрын
what about jsx file
@243065294 жыл бұрын
this whole mixing of html syntax with JS syntax is a pure mess at least for the beginners .. I mean, at the very beginning of the web applications, people used to write JS code in the HTML and we were taught in the colleges how bad that is, we should keep JS and HTML codes separate and hence JQuery and AngularJS were born .. and look at this .. its like going backwards .. doing all this better have some advantages now otherwise its pure frustration for newbies
@logs5 жыл бұрын
You should really learn to use ; That makes code more readable.
@Breezbriznost5 жыл бұрын
You don't need to use ; in React
@logs5 жыл бұрын
@@Breezbriznost It's optional. However, it looks good when using it.
@243065294 жыл бұрын
@@Breezbriznost yes it is optional but its a good practice and leaves no room for errors later..I suggest to watch videos from douglas crockford