如何使用React开发前端和使用Express后端,以及使用Webpack捆绑后使用jQWidgets和API请求?

问题描述 投票:0回答:0

我按照本手册开发应用程序,可以使用Axios或Fetch API将API请求从前端(React app)发送到后端(Express) https://hackernoon.com/full-stack-web-application-using -react节点-JS-EXPRESS-和的WebPack-97dbd5b9d708

本手册非常好,几乎满足了我的所有需求,除了一个。 我想使用“JQWidgets”中的一些组件。

所以当我向package.json添加npm包“jqwidgets-scripts”时

"jqwidgets-scripts": "~6.0.5"

并只导入一个组件

import JqxButton from "jqwidgets-scripts/jqwidgets-react/react_jqxbuttons";

我收到错误

./node_modules/jqwidgets-scripts/jqwidgets-react/react_jqxbuttons.js 217:12
Module parse failed: Unexpected token (217:12)
You may need an appropriate loader to handle this file type.
|         this.componentSelector = '#' + id;
|         return (
>             <div id={id}>{this.props.value}{this.props.children}</div>
|         )
|     };

我还尝试使用官方指南达到目标,使用此页面中包含React,Express,Webpack和JQWidgets的工具进行开发https://www.jqwidgets.com/reactjs-components-documentation/documentation/webpack_react/index.htm

所有工作除了发送API请求的可能性外。

那么如何编译两个配置以使用JQWidgets和API请求后端部分?

node.js reactjs express fetch-api jqwidget
© www.soinside.com 2019 - 2024. All rights reserved.