我的代码如下。模板文字不在 span 标签中创建多行字符串,而在控制台中创建多行。
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
class MyApp extends Component {
render() {
console.log(`string text line 1
string text line 2`);
let test = `dfas dss
sdassas`;
return (
<span>{test}</span>
)
}
}
ReactDOM.render(
<MyApp />,
document.getElementById('app')
);