我在反应中遇到了这个语法错误:
t.test

我已多次查看每个标签和支架,看看是否所有标签都有开关标签/支架,我似乎无法找到错误。它可能是别的东西,但我在javascript中发现错误还不够好。
我也不理解错误信息,当它说'#34;期望"
时,它是什么意思?以下是错误消息引用的代码:
Unexpected token, expected , (22:4)
20 | </div>
21 | </div>
> 22 | )}
| ^
23 | </section>
24 | );
25 | }
&#13;
提前致谢! :)
答案 0 :(得分:1)
正确的缩进有助于解决以下问题:)
关闭地图功能,如下所示:
import React, { Component } from 'react';
import dropdownlist from './dropdowndata';
class Links extends Component {
render() {
return (
<section>
{dropdownlist.map(drop =>(
<div className="dropdown">
<button className="dropdownhover"> {drop.name} </button>
<div className="links">
{drop.button.map(button => (
<div className="linkssection">
<h2> {button.title} </h2>
<ul><li><a className="singlelink" href={button.url}>{button.urlText}</a></li></ul>
</div>
))} // <-- close here
</div>
</div>
} // <-- fixed
</section>
);
}
}
export default Links;
答案 1 :(得分:1)
关闭第一个地图功能。
import React, { Component } from 'react';
import dropdownlist from './dropdowndata';
class Links extends Component {
render() {
return (
<section>
{ dropdownlist.map(drop =>(
<div className="dropdown">
<button className="dropdownhover"> {drop.name} </button>
<div className="links">
drop.button.map(button => (
<div className="linkssection">
<h2> {button.title} </h2>
<ul><li><a className="singlelink" href={button.url}>{button.urlText}</a></li></ul>
</div>
))
</div>
</div>
))}
</section>
);
}
}
export default Links;