./ src / index.js 第26行:解析错误:reactjs中出现意外令牌。
我的代码,
fetch('https://www.reddit.com/r/reactjs.json')
.then((result) => {
// Get the result
// If we want text, call result.text()
return result.json();
}).then((jsonResult) => {
// Do something with the result
console.log(jsonResult);
})
}
我累了会显示代码错误,
Failed to compile
./src/index.js
Line 26: Parsing error: Unexpected token
24 | }
25 |
> 26 | fetch('https://www.reddit.com/r/reactjs.json')
| ^
27 | .then((result) => {
28 | // Get the result
29 | // If we want text, call result.text()