Conditional Rendering Best Practices for React

preview_player
Показать описание
This is a complete guide to conditional rendering in #React, why it works the way it does, and how you should handle it for all data types 🌹
We also cover key #JavaScript concepts that make this possible ❤️

#basarat

Chapters:
0:00 Intro
0:22 Falsy values
0:53 Reacts handling of falsy values
2:01 JavaScript And Chaining
3:07 Conditional Rendering Examples
5:15 Conditional Rendering with numbers
6:39 Better approach
8:02 Final thoughts

👇 ❤️ Subscribe for MOORE ❤️ 👇

**Feel Free To Read This Lot**

I'm Basarat, and I love helping developers. More about me:

Microsoft MVP for TypeScript
200K contributions on Stackoverflow. Top Contributor for TypeScript.
Book Author : Beginning NodeJS
Book Author : TypeScript Deep Dive
Creator of multiple hot ✨ed Github Open Source projects

Рекомендации по теме
Комментарии
Автор

Excellent! I didn't want to miss anything, so I watched it twice. 👏

VaughnMelson
Автор

Oh boy the team is going to love me on all their PRs come tomorrow!

cas
Автор

Hey is there any better way to do conditional rendering.... For example toggles or radio buttons say I have 5 initially all are set to false so if I open one then two i only want the current one which I opened to show content in that what I am doing is whenever a toggle is opened first close all other toggles.. in my case 5 so 5 states.. but say for 50 100 toggles what would be the most elegant solution ?

saxenavedant
Автор

dude just rickrolled me while teaching me this LMAOO

magnaimunkhzul
Автор

what do you think of messages.length>0&&<div>your element</div> instead of !!messages.length&&<div>your element</div>?

deFrontComOFer
Автор

We can use Boolean(arr.length) && <><\> also

chinmoypradhan