React 101 - 3/11 - Conditional class rendering

preview_player
Показать описание
Learn how to render CSS class based on a specific condition using React.

For more advanced CSS class rendering use classnames module:

React tutorial for beginners.

Download working files

Or signup to React 101 on my website to watch this course directly on my site without any ads.

React 101

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

Sometimes a stupid beginner like me needs a quickly answer... I love your video, no boring intro just the info that I need, good Job, you earn subscriber

rafaelcalderon
Автор

But what about within a MAPPED data array with keys

errinwright
Автор

I am trying to do this in a functional component using useState hook. But it is adding the class to all the panels. It should add the class only on the clicked element. Please help Thanks...

DheerajVermagwd
Автор

Is there any reason why should I use this kind of way instead of just classList.toggle("")? Is it to keep the "react way"?

AndersonSousa
Автор

How to do it with ul list items? I mean when I click on one of the li I want to add class active on this element but remove (if there are any) from others li? You know, typical menu for example.. I'm new in React and try to solve this problem, but so far I didn't found a solution.

kasha_blanca
Автор

this is great video just wish it was longer. please do a monster long one pleeease

boboboboboboo
Автор

The css you used throws error in my .css file. Solution?

chaosinorderrr
join shbcf.ru