React embraces Javascript
React essentially is javascript that you already know. There is no syntactic sugar that you need to learn.
React is fully compatible with Javascript
React is a small set of APIs and it fully embraces Javascript constructs. Except for JSX, when you are using React, you are writing Javascript. We don’t need any weird framework-specific syntax to iterate over arrays or show/hide content.
Show different content on condition
Try to change show={false}
on show={true}
in the following code.
The following code has a small bug. I hit this bug when creating this course and decided to keep it here just to explain how evaluation works with { }. Click Run and you won’t see anything. Try figuring out why. Then continue below to see the explanation.
Get hands-on with 1400+ tech skills courses.