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

Making a functional or stateless component

So far, we have only learned how to create class components in React. These components are useful when you need to handle local state, but in some cases, we will need to render static markup. For static components, we need to use functional components, also known as stateless components. This will improve the performance of our application.

In the Passing props to a component and validating them with PropTypes recipe, we created some layout components (Header, Content, and Footer). These components, as you may imagine, are frequently not dynamic (unless you want to have a toggle menu or some user information in the header), so in this case, we can convert them into functional components.

主站蜘蛛池模板: 韶山市| 宝山区| 城口县| 斗六市| 通江县| 长汀县| 克山县| 通渭县| 汶上县| 星子县| 密云县| 常德市| 吉林省| 仁怀市| 嘉义市| 宣城市| 定日县| 广平县| 六安市| 蕉岭县| 股票| 兴山县| 武山县| 新昌县| 永定县| 平顺县| 建昌县| 宽城| 正蓝旗| 龙门县| 青州市| 盱眙县| 彭泽县| 富锦市| 长春市| 屯门区| 隆子县| 获嘉县| 江阴市| 敦煌市| 京山县|