React: jsx extra semicolon bug?

Created on 20 Aug 2015  路  2Comments  路  Source: facebook/react

When i use semicolon in my jsx code:

render() {
    var imageList = this.state.imagestore || [];
    return (
      <div className="main todos" ref="asdf">
        <ul>
          {imageList.map(function(item) {
            return <li>{item.name}</li>;   {/* The extra semicolon here.  /}
          })};
        </ul>
      </div>
    );
  }

But so strange, it print to my html page:

<ul data-reactid=".0.4">
   <li data-reactid=".0.4.0:0">鍥剧墖1</li>
   <li data-reactid=".0.4.0:1">鍥剧墖2</li>
   <li data-reactid=".0.4.0:2">鍥剧墖3</li>
   <span data-reactid=".0.4.1">;</span>  <!-- The extra span here -->
</ul>

Could somebody tell me why ?

Most helpful comment

It's the semicolon in })}; that you don't want.

All 2 comments

It's the semicolon in })}; that you don't want.

@spicyj Thank you!

Was this page helpful?
0 / 5 - 0 ratings