我正在尝试编译的React项目上工作,但找不到为什么我遇到此语法错误。具体来说,在这种情况下,模式“ {{)=> {}()}”在做什么?
Module build failed: SyntaxError: Unexpected token, expected } (35:9)
33 | return (<div className="loading" />);
34 | }
35 | }()}
| ^
36 | </div>
37 | );
38 | }
@ ./src/containers/SearchApp.js 7:0-52
@ ./src/containers/App.js
@ ./src/index.js
@ multi ./src/index
Run Code Online (Sandbox Code Playgroud)
代码部分:
render() {
return (
<div>
<div className="form-group">
<input onKeyDown={this.searchEnter.bind(this)} type="text" ref="tag" className="form-control input-lg search-bar" placeholder="Enter the tag..." />
<button onClick={this.searchClick.bind(this)} type="button" className="btn btn-default search-button">Search!</button>
</div>
{()=>{
if (this.props.status === 'PENDING') {
return (<div className="loading" …Run Code Online (Sandbox Code Playgroud)