经过几个小时的网络搜索后,我还没有找到解决我的问题的方法。所以我正在 React 和 Java Spring Boot 上构建一个全栈 CRUD 应用程序。到目前为止,我已经能够在 localhost://8080 上运行后端存储启动。当我在 localhost://3000 上运行前端 React 时出现问题 -> React 应用程序不断加载并且我看到\xe2\x80\x9cUncaught (承诺中) SyntaxError: Unexpected token < in JSON at 位置 0\xe2\x80\ x9d控制台中的错误。
\n应用程序.js:
\nimport React, { Component } from \'react\';\nimport logo from \'./logo.svg\';\nimport \'./App.css\';\n\nclass App extends Component {\nstate = {\nisLoading: true,\ngroups: []\n};\n\nasync componentDidMount() {\nconst response = await fetch(\'/api/groups\');\nconst body = await response.json();\nthis.setState({ groups: body, isLoading: false });\n} ->\nRun Code Online (Sandbox Code Playgroud)\n此处出现语法错误
\nrender() {\nconst {groups, isLoading} = this.state;\n\nif …Run Code Online (Sandbox Code Playgroud)