在reactjs中获取错误验证记忆如何修复?

在reactjs中获取错误验证记忆如何修复?,reactjs,jsx,Reactjs,Jsx,我的控制台中出现错误: 下面是content.js的代码,它清楚地显示了所有内容,但当我的web应用程序变得复杂时,警告是否会在渲染上出现任何问题。 截图: content.js文件: class Content extends Component { constructor(props){ super(props); this.state = { matches:[], loading:true

我的控制台中出现错误:
下面是content.js的代码,它清楚地显示了所有内容,但当我的web应用程序变得复杂时,警告是否会在渲染上出现任何问题。 截图:

content.js文件:

class Content extends Component {
    constructor(props){
        super(props);
        this.state = {
            matches:[],
            loading:true
        };
    }

    componentDidMount(){
        fetch('api/matches')
        .then(res => res.json())
        .then(res => {
      console.log(res)
      this.setState({
        matches:res,
        loading:false
      })
    })
    }

    render() {
        if (this.state.loading) {
            return <div>>Loading...</div>
        }

    return (
      <div>
          <div class="row">

            <div class="col-lg-3">
                <div id="one">
                    <p class="match">Match {this.state.matches[0].id}</p>
                    <p><h4>{this.state.matches[0].team1}</h4></p>
                    <p>VS</p>
                    <p><h4>{this.state.matches[0].team2}</h4></p>                  <====  LINE   39
                    <div class="winner">
                        <h3>Winner</h3>
                        <h4>{this.state.matches[0].winner}</h4>
                    </div>
                    <div class="stats">
                    <button type="button" class="btn btn-primary">View Stats</button>
                    </div>
                </div>
            </div>
          </div>
      </div>
    );
  }
}

export default Content;
类内容扩展组件{
建造师(道具){
超级(道具);
此.state={
匹配项:[],
加载:正确
};
}
componentDidMount(){
获取('api/匹配项')
.then(res=>res.json())
。然后(res=>{
console.log(res)
这是我的国家({
比赛:res,,
加载:错误
})
})
}
render(){
if(this.state.loading){
返回>加载。。。
}
返回(

匹配{this.state.matches[0].id}


{this.state.matches[0].team1}

VS


{this.state.matches[0].team2}

根据此文档。可以删除h4标记,也可以删除其外部的p标记

<p className="your_class">{this.state.matches[0].team1}</p>

{this.state.matches[0].team1}

或者你可以这样做

<h4>{this.state.matches[0].team1}</h4>
{this.state.matches[0].team1}

{this.state.matches[0].team1}

@stack26我是否应该删除
,然后我是否应该稍后对其进行样式设置,因为我希望文本大小更大。是的,完全正确!!您必须进行样式设置是不同的,因为
h4
提供语义好处(用于SEO)虽然设置
p
的样式只会产生视觉上的差异,但最好使用
h4
对不起,当p内部使用h4时,它允许但会发出警告。当您将p用作tbody的子对象时,也会发生同样的情况。