reactjs - Unit conversions, permissions, and other transforms in Flux & React -


At the point directly: where there are behavior related to unit conversion (for display and input), permission check and other presentation. Transforms are in a Flux architecture?

An example of "other presentation related changes" in our case is implementing the user layout setting in a view. For example, a user can define what data field to view in the summary view And look for them in order.

We feel that we consider it a part of the solution to this problem: These changes are application states and live in various state stores ("Weeksmamer Layout Story", "Unit Pariphance Store").

What do we want to know is that those states should be in alignment with the flux architecture to apply to get the final presentation results. . We have come up with various options:

1) Give feedback on the component. The mixer handles things such as unit conversion in the "render" method of each bar component. Various presentation state stores are covered in component manufacturer, and the mixer automatically wraps things (listen to different state stores, updates, etc.).

2) Use an intermediate store, Weeksmummy Presentation Datastore, who hearss WeeksmdMathStast, Weeksmmer Layout Story, and Spits Out Presentations and Final Presentation Data for the Unit; The component then listens to the appropriate *** presentationstore and deals with updates & amp;

3) Integrate all the changes in the original data store and spit out the presentation-ready data to the store.

Argument for / against each?

1) The last leaf component must be the only module to know how to "present" the data. Of course, determining the data description based on unit conversion, layout implementation, and permissions is part of this presentation logic. There are many additional layers, but do not need to know anything about decoupled well, further changes to the original data collection. The main business logic of each store can be reused in components, each component can present different data depending on the different presentation state stores.

2) What was added complexity?

3), Some presentation logs are part of business logic and may be owned by the main data store. Significantly, the complexities are reduced, but if businesses require the same core store, but requires a different presentation mode then the business permits the repetition of the argument.

Thoughts? If your changes are "pure" functions, they can remain in a Utils module.

UTILS are bags of stable work, there is no application-specific dependency (although a web APIUtilles module is a notable exception to this rule, since it requires all data in the store required for API calls) These application-dependency-free access modules can now be needed in any component or store they need.

You can make a mix for the scene layer instead, make sure that I personally prefer the module for the mix, because it is easy to understand that any method Where is defined.

As far as you should store the changes, I think that you probably should not, but it is probably something that needs to be decided on a case-by-case basis. It feels like a tight pair of your visual and data layers, and they should probably operate more independently.


Comments