【发布时间】:2020-12-14 23:00:05
【问题描述】:
我有这个 SMN() 函数,并在其中创建了 Site 函数作为 Const。所以我需要在 Render() 函数中调用 Site 函数。这是主要功能代码:
SMN() {
const Site = () => {
return (
<View style={{ height: 400 }}>
<WebView source={{ uri: 'https://www.google.com' }} style={{ marginTop: 20 }} />
</View>
);
}
});
这是 Render() 函数,我想从中调用 Site 函数,我使用过: this.SMN().Site ,这不会抛出错误,但不会显示任何错误。
render() {
return (
</View>
<View>{this.SMN().Site}</View>
</View>
)
}
【问题讨论】:
-
为什么另一个函数里面有一个函数?
标签: javascript html function react-native