Recently use react to do project practiced hand, the project call interface has cross-domain problem, the reference plug-in is Axios,react project is created with Create-react-app, solve cross-domain problems can be set in the background Cros (cross-domain resource sharing), if the front-end solution can use the proxy, Projects built with Webpack can be configured in Webpack.config.js, Create-react-app-created projects Webpack configuration integration in React-script integration, not well configured, you can configure the proxy in the Package.json file .
Indicates that the prefix requested in the interface is the value of the proxy, such as the interface to be requested is https://www.aaa.com/app/userQry, in the Package.json proxy is set to ' Https://www.aaa.com/app ',
The URL for calling the function to request data is userqry. The following is the requested function.
Create-react-app creating react projects, using Axios cross-domain