官术网_书友最值得收藏!

  • The React Workshop
  • Brandon Richey Ryan Yu Endre Vegh Theofanis Despoudis Anton Punith Florian Sloot
  • 251字
  • 2021-06-11 18:28:32

Introduction

In the previous chapter, we have built applications with relatively complex forms and all of that featured information that always got displayed; as in, there was no hidden data involved. In many applications, however, there tends to be portions of the app where the data is hidden and isn't loaded until you perform some action. You can do this in a few ways using other web development languages that are not typically the best choices. For example, you could hide elements on a web page with CSS using display:none; but then those sections would still show up if people viewed the source or overrode those CSS rules in your browser. Therefore, this would not be a great way to tackle the situation. Instead, we can rely on writing good JavaScript and React code to only display certain elements or components when it is appropriate, using conditional rendering.

In addition, you will frequently find yourself in a position where you need to display the same elements multiple times on a web page. Sure, you could copy and paste a bunch of times and hope you have gotten the number of elements correct, but it is far cleaner and easier to use loops in React to display multiple repetitive elements.

There are, of course, a few things you will need to be mindful of as you implement these features, but ultimately, they are pretty simple little things you need to remember, and we will cover them throughout the course of this chapter.

主站蜘蛛池模板: 花莲县| 辉南县| 西昌市| 黑水县| 丁青县| 三河市| 凯里市| 宣恩县| 红桥区| 张北县| 抚顺市| 麟游县| 淮滨县| 饶平县| 峡江县| 响水县| 鄄城县| 东台市| 金平| 东台市| 马龙县| 海盐县| 上虞市| 盐津县| 铜陵市| 郯城县| 繁峙县| 隆子县| 原阳县| 湘西| 房产| 宁强县| 嘉荫县| 镇安县| 胶州市| 通海县| 龙州县| 和田县| 青浦区| 东宁县| 尉犁县|