0

I've created a small ReactJs application which is bundled using Webpack. Backend is done using Java (Spring Boot) and I'm running the app in my laptop (new Macbook Pro). I've tested it in Chrome and noticed that it takes considerably amount of time before REST API call (find_all) is invoked from the bundle file (positions_bundle.js), see the screenshot below. Does this look like normal performance using these technologies? I've run the front end using both Spring Boot and Webpack dev server and between those there isn't any significant difference.

enter image description here

EDIT. This is my React class which creates REST API call:

import React from "react";
import axios from "axios";
import {connect} from "react-redux";
import {bindActionCreators} from "redux";
import {setPositionData} from "../actions/setPositionData";

class PositionDataFetcher extends React.Component {

   constructor(props) {
      super(props);
   }

   componentDidMount(){
      axios.get('http://localhost:9000/jmap/position/find_all')
         .then(function (response) {
            // console.log(response.data);
            this.props.setPositionData(response.data);
         }.bind(this)
         )
         .catch(function (error) {
            console.log(error);
         });
   }
   render(){
      return null;
   }
}

function mapStateToProps(state) {
   return {
      positionData: state.positionData
   };
}

function matchDispatchToProps(dispatch) {
   return bindActionCreators({setPositionData: setPositionData}, dispatch);
}

export default connect(mapStateToProps, matchDispatchToProps)(PositionDataFetcher)
4

0 回答 0