LoginSignup
1
2

More than 5 years have passed since last update.

ReactでSyntax error: Adjacent JSX elements must be wrapped in an enclosing tag

Posted at

なんやねーーん

Syntax error: Adjacent JSX elements must be wrapped in an enclosing tag

参考

Reactで「閉じろ」と怒られる

ReactでSyntax error: Adjacent JSX elements must be wrapped in an enclosing tag

問題のソース

class LikeButton extends React.Component {
  render() {
    return (

      <span>いいねボタン予定地</span>


      <div className="facebookiine">

      <h1>Reactで作った「いいねボタン」のデモ (Flux不使用)</h1>
      //<div id="like-button"></div>
      //<script src="like-button.js"></script>
      </div>

    );
  }
}

隣接要素たちは単一のタグでラップされていなければならない

なるほど...訳の分からぬやつや!


class LikeButton extends React.Component {
  render() {
    return (


      <div className="facebookiine">
      <span>いいねボタン予定地</span>
      <h1>Reactで作ったいいねボタンのデモ (Flux不使用)</h1>
      //<div id="like-button"></div>
      //<script src="like-button.js"></script>
      </div>

    );
  }
}

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2