reactでコンポーネントとスタイルを定義しています。
コードは以下の通りです。
typescript
1 2const styles = { 3 card : { 4 height: 100, 5 width: 100, 6 }, 7 title: { 8 fontSize: 14, 9 } 10} 11 12const MyComponent = (props: any) => { 13 const { classes } = props; 14 return ( 15 <div> 16 <Card className={classes.card}> 17 <CardContent> 18 <Typography className={classes.title} color='textSecondary'> 19 Card Title 20 </Typography> 21 </CardContent> 22 </Card> 23 </div> 24} 25export default withStyles(styles)(MyComponent);
この時に使用する側で
typescript
1 <div> 2 <MyComponent titleText="My Title Text" /> 3 </div>
のようにして値を渡してCard Title
の部分に適用したいのですが、
どのように書けばいいのでしょうか。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。