我使用的是 response。我想在字符串之间添加一个换行 <br>
“无结果”和“请尝试其他搜索项”。
我试过 'No results.<br>Please try another search term.'
但是它不工作,我需要在 html 中添加 <br>
。
有办法解决吗?
render() {
let data = this.props.data;
let isLoading = this.props.isLoading;
let isDataEmpty = Object.entries(data).length === 0;
let movieList = isLoading ? <Loader /> : isDataEmpty ? 'No results. Please try another search term.' :
Object.entries(data).map((movie, index) => <MovieTile key={index} {...movie[1]} />);
return (
<div className='movieList'>{movieList}</div>
);
}