gpt4 book ai didi

javascript - 返回并显示传递给卡片中组件的值

转载 作者:行者123 更新时间:2023-12-03 03:38:06 25 4
gpt4 key购买 nike

Card.js

const Card = () => {
const { CardStyle, HeadingStyle, bottomStyle, Top } = styles;
return (
<View style={CardStyle}>
{/* {props.children} */}

<CardTitle titleText={"Feedback"} EditButton={true} />
{/* <CardTitle titleText={"My Skills"} EditButton={false} /> */}

<View />
<SeeMore />
</View>
);
};

卡中的组件用于获取参数并显示 View

const CardTitle = ({ titleText, EditButton = false }) => {
const { HeadingStyle, TitleStyle } = styles;
if (EditButton == true) {
<Text style={HeadingStyle}>Edit</Text>;
}
return (
<View style={TitleStyle}>
<Text style={HeadingStyle}>
{titleText}
</Text>
</View>
);
};

我传递的值,即在 Card.js 中,titleText“反馈”不会在我的卡片显示中打印?

如何打印卡片上传递的“反馈”字样? 有点解决了

最佳答案

只需:

const CardTitle = (titleText, EditButton = { False }) => {
const { HeadingStyle, TitleStyle } = styles;
if (EditButton) {
}
return (
<View style={TitleStyle}>
<Text style={HeadingStyle}>
{titleText.titleText}
</Text>

<Text style={HeadingStyle}>Edit</Text>
</View>
);
};

但应该是

const CardTitle = (props) => {
...
{props.titleText}
...
}

关于javascript - 返回并显示传递给卡片中组件的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45760629/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com