javascript - Flux architecture misunderstanding in example chat app -


I'm trying to understand. The authors mentioned this unidirectional data flow: Enter image details here

However In the example, there are dependencies between the action creators () and store () in the app, and store (,) and Web API Utils (), which is against unidirectional data flow rule: Enter image details here

Is it recommended to follow the given example? Has been done, or should it be designed in a better way?

Update

I found that ChatMessageUtils are not related to Web API utilities, so there should not be two arrows from the store pointing there, so they might be okay. However the relationship between action crews and the store is still weird.

The example is a little compelling, and how it was designed to try to show how to wait () The WebAPI aspect of the works is very semi-baked and should actually be modified.

However, MessageStore.getCreatedMessageData (text) A value passes in the store, it is still a gateer is not setting the data on the store. It is actually a utility system Is being used in the form, and a good revision (bridge request?) Will be to move that method to the Utilis module.

To make things better for the real world example, some things you do:

  • Instead of the operator, call the WebAPIutils in the store. It is fine as long as the response calls another ActionCreator, and it is not operated directly by setting up new data on the store. The important thing is that for new data of origin with one action, it is more important how the data emerges from the system, apart from how the system is entered.

  • Alternatively, you must have separate client-side versus server-side IDs for the message. There are some benefits of this, such as managing optimistic references. In that case, you want to generate a client-side ID in the Utilis module, and pass that ID to both the text sent along with the text and the WebAPI utility.

    Everyone said, yes, there is a need to amend the example.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -