Search code examples
javascriptreactjsreactjs-flux

Trying to understand Flux architecture


I am working alone in a project, first time using React and still trying to understand it.

The issue I have so far is the connection/relation between files. All I am doing now is getting from the backend a list of Dealers for a Casino Game which I should display in a screen, it is just a list that should appear when a user clicks on a button with the function _getDealersList() which is in the component part.

All I have so far is this where I am doing a GET request in order to get the list of the dealers.

import axios from 'axios';

const API_ENDPOINT = `${API_URL}/services`;

const GetDealers = {
  getDealers : {
    remote (state, params) {
      return axios.get(`${API_ENDPOINT}/get-dealers/get-dealers`, params);  
    },
  },
};

export default GetDealers;

that is a service.

I need to know how to connect that with an action and with a store, so I can call it in the frontend.

I've been reading a lot but still unable to adapt it what I read to my code. I am just a junior developer and it seems as if Reactjs is for someone with some more experience. But I am trying to learn, hope you can help me.


Solution

  • I recently went through the same problem and I can agree there aren't good walkthroughs, the better I found was http://alt.js.org/guide/ which is tied to alt which seems the simpler Dispatcher implementation to work with and the less verbose.

    I know it's not a complete answer but it's pointless to copy-paste a whole tutorial