Redux/React and MVC, OOP

2019-06-24 02:58发布

问题:

Can React/Redux be thought of as an MVC framework in which also captures core Object Oriented principles? From my experience we have a fat model (the global state/store) and skinny controllers (actions creators) which dispatch certain actions in the right direction (action types used in Reducers) to create the new state object and hydrate our views (React).

I think React encompasses abstraction through components and subcomponents, inheritance/polymorphism by extending the Component class to write your own. And I feel as if containers enable a sense of encapsulation which hide/show certain redux functionality to/from the components.

This is how I've come to think of Redux/React architecture but am not sure this is right. Am I missing any key points or distinctions?

回答1:

Why do you need OOP principles? Redux and React-redux libraries are about functional programming. Take a look at this video first - https://vimeo.com/69255635, then free online course from Redux's author - https://egghead.io/lessons/javascript-redux-the-single-immutable-state-tree