我无法从api调用某个参数
constructor(props) {
super(props);
this.state = {
news: [],
loading: true,
activeIndex: 0,
description: '',
}
}
componentDidMount() {
console.log(this.props);
let description = this.state.description;
let regex = /(<([^>]+)>)/gi;
let result = description.replace(regex, '');
this.setState({ description: result });
我用这样的代码称呼他
{item.description}
答案 0 :(得分:0)
您可以像在componentDidMount
函数中一样引用它:
{this.state.description}