【发布时间】:2019-10-28 07:22:12
【问题描述】:
我对原生反应和一般使用 UI 构建任何东西都比较陌生。我想知道在编写应用程序时何时使用 render{} 函数合适。我问这个是因为我想知道对应用程序的影响。例如,如果我创建了一个<LinkedIcon> 组件并尝试在一个屏幕上显示大量它们,那么每个点都应该调用render。如果不是,我会怎么做。
示例代码:
import React, { Component } from "react";
import { Linking, View, TouchableHighlight } from "react-native";
import Icon from "react-native-vector-icons/FontAwesome";
class LinkedIcon extends Component<Props> { //will show about up to 20 on one screen
render() {
return (
<TouchableHighlight>
<Icon title="circle" size={15} />
</TouchableHighlight>
);
}
}
export default LinkedIcon;
【问题讨论】:
标签: javascript react-native render jsx