我的代码 react 出了什么问题
export const BeritaView = ({ match }) => {
const article = articles.find(item => item.id === match.params.id);
console.log(articles, match.params.id);
return(
<div>
<h3> News ID: {match.params.id} </h3>
<h4> {article.title} </h4>
<p> {article.content} </p>
<Link to={`/berita`}> Back to Berita dan Kegiatan </Link>
</div>
)
}
错误调用此:
'import' and 'export' may only appear at the top level
谁能帮我吗?
最佳答案
大多数情况下,当您在 react 代码中错过右括号时,就会出现此错误。
关于javascript - ReactJS 怎么了 'import' 和 'export' 可能只出现在顶层?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52148510/