3 回答

TA貢獻1872條經驗 獲得超4個贊
我建議你使用模板文字
沒有模板的例子
? ? console.log('string text line 1\n' +
'string text line 2');
// Output be
// "string text line 1
// string text line 2"
模板示例
console.log(`string text line 1
string text line 2`);
// Output be
// "string text line 1
// string text line 2"

TA貢獻1891條經驗 獲得超3個贊
如果您碰巧使用,JSX您實際上可以使用HTML.
使用功能組件:
function TermsAndConditions() {
return (
<div>
<p><strong>Paragraph in bold</stron></p>
<p>Normal paragraph</p>
</div>
);
}
function Footer() {
return <TermsAndConditions/>
};
ReactDOM.render(
<Footer/>,
document.getElementById('footer')
);
或者使用類組件:
function TermsAndConditions() {
return (
<div>
<p><strong>Paragraph in bold</stron></p>
<p>Normal paragraph</p>
</div>
);
}
class Footer extends React.Component {
render() {
return (
{this.props.message}
)
}
}
ReactDOM.render(
<Footer message={<TermsAndConditions/>}/>,
document.getElementById('footer')
);
添加回答
舉報