【发布时间】:2022-11-16 01:43:55
【问题描述】:
编写此函数而不重复某些值并且只添加所需值的最佳方法是什么初始文本
createThread = () => {
if (this.props.first) {
publishLow = window.google.createPublish({
readId : this.props.readId
});
} else {
publishLow = window.google.createPublish({
readId : this.props.readId,
// The value needed in this condition
initialText : this.props.initialText
});
}
};
【问题讨论】:
-
就我个人而言,我会保持原样。它使其更具可读性和可测试性。
标签: javascript reactjs