4 ms·
Redux is an independent project from React. You could use redux with Vue. Your other points are valid but detracting from one library because people often use
by rudolph9 8y ago
Redux is an independent project from React. You could use redux with Vue. Your other points are valid but detracting from one library because people often use another you don’t care for seems outside the scope of React vs Vue.
- dmix 8y agoJust for the record most people using vue would be using Vuex: https://vuex.vuejs.org https://vuex.vuejs.org Which IMO is simpler to understand as a newbie than Redux. Maybe because it had the luxury of coming after Redux/similar projects and underpinning a simpler parent framework.
- Zooper 8y agoSounds as of 3.0 it became much simpler, as vuex doesn't sound as necessary.
- yurishimo 8y agoI’ve yet to build a Vue app that I felt needed external state management (though admittedly none are huge SPAs) but I have felt the pain in React working on a similar sized project. Just something about how the events work out of the box. React I felt like I needed to pass in functions to change parent state through a callback function in props, whereas in Vue I just emit the event and forget about it. You can still use the function prop pattern in Vue but it doesn’t make much sense when event emission is so much simpler to reason about.
- dmix 8y agoI purposefully avoid Vuex until a) the state becomes large or b) deeply nested objects (which reacitivity handles poorly, as whole trees rerender) or c) when I have lots of deep nested Components with a maze of events. This is where I've found Vuex is a life saver for reducing complexity, organizing state in a seperate area, and having a consistent interface for accessing/mutating data without a tangled web of events and functions across multiple files/layers.
- com2kid 8y agoRedux is at its core super simple. Action handler gets data, does business logic stuff, sends result off to reducer that publishes the data back to the UI layer. Online explanations of this suck.
- javitury 8y agoFor me, how vuex works was very very easy to visualize. State, mutations and actions are very intuitive. On the other hand, redux's reducers are harder to visualize at the beginning. Until you learn how the reducer works, every reference to "reducer" leaves you slightly confused. I visualized redux's better with a simple example. It helps you to see how state and reducers interact.
- com2kid 8y agoLong before learning of React or redux I built a similar system to do IPC between two embedded MCUs. All state was owned by the master MCU, slave MCU sent messages to the master requesting changes of state, the entire state for the slave CPU was then sent over with the requested changes. Even what UI screen was shown was handled this way. I was much more junior then, so the entire system wasn't event driven, all state was transferred every 33ms (iirc). Redux is moderately more complex than that system, although my system was built in pure C and involved interop between C and C# running in an interpreter.