上面的错误发生在<div>组件-React.js中

时间:2019-02-26 11:57:57

标签: javascript reactjs

所以,我正在尝试启动一个React App。我将一些HTML内容从模板复制到了组件中。我遇到了一个错误,并且不清楚如何处理。这是错误:

'index.js:1446 The above error occurred in the <div> component:
    in div (at App.js:57)
    in div (at App.js:28)
    in div (at App.js:15)
    in div (at App.js:14)
    in App (at src/index.js:7)

这是我在App.js中放置的代码:

import React, { Component } from 'react';
import logo from './logo.svg';
import Test from './components/Test.js'
import './App.css';


class App extends Component {
render() {
return (

<React.Fragment>
  <Test />

<div className="probootstrap-hero">
  <div className="container">
    <div className="row">
      <div className="col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 text-center probootstrap-hero-text pb0 probootstrap-animate" data-animate-effect="fadeIn">
        <h1>Launch your awesome startup now!</h1>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto provident qui tempore natus quos quibusdam soluta at.</p>
        <p>
          <a href="#" className="btn btn-primary btn-lg" role="button">Get This App</a>
          <a href="#" className="btn btn-primary btn-ghost btn-lg" role="button">Try it for free</a>
        </p>
        <p><a href="#"><i className="icon-play2"></i> Watch the video</a></p> 
       </div>
      </div>
     </div>
    </div>

   </React.Fragment>
)}

1 个答案:

答案 0 :(得分:1)

当您将样式用作字符串而不是对象时,会发生这种情况-不太常见的其他原因,例如使用对象作为样式并在其toString方法中引发错误。

但这是引发此类错误的最主要原因

// the following is JSX and not html
<div style="color:red" />