javascript - return and display a value passed to component in a card -
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> ); }; component in card take parameter , display views
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> ); }; the value i'm passing, i.e in card.js titletext "feedback" won't print in card display?
how print "feedback" word passed card? kinda solved
just with:
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> ); }; but should
const cardtitle = (props) => { ... {props.titletext} ... }
Comments
Post a Comment