10 ms·
> We discovered that VueX makes our lives easier. If you are writing a medium to large feature, use VueX. If it's a tiny feature, you might get away without it.
by ng12 9y ago
> We discovered that VueX makes our lives easier. If you are writing a medium to large feature, use VueX. If it's a tiny feature, you might get away without it.
I feel like this is Vue starting to get the React treatment. React was (and still is!) a very simple library until people realized they needed to do fancy things to make complex applications manageable. Redux came out, everyone fell in love with it, and React+Redux became an official couple. This lead to the perception that React has a steep learning curve because new developers were learning React+Redux without learning React first.
I wonder what Vue can do to avoid the same pitfall.
- sametmax 9y agoIt avoids it by design. Most of my vue project only uses vue. Not even webpack. Just the static vue file. I don't even have that many components because view doesn't force that on me. It's good enough and fast enough as it is for most medium side projects. And the awesome thing is that you can scale it up for this one big project you need it for.
- a13n 9y agoWhen did new react developers start learning redux? From my experience that just isn't true.
- lucideer 9y agoWhile I personally avoided this pitfall and learnt React alone before Redux, I have not meet anyone else who did the same. Literally everyone I've talked to about learning React did so (or tried, and failed to do so) with both, up front.
- a13n 9y agoWow, I wonder where people are getting the idea that they need to learn Redux. If you start a new job at a company that uses React, then you probably need to learn React + Redux simultaneously. But if you're just picking up React, Redux isn't useful whatsoever. This image, from React conf years ago, communicates this sentiment perfectly: https://i.stack.imgur.com/tnk9a.png https://i.stack.imgur.com/tnk9a.png
- k__ 9y agoI started with Redux too, because the lead dev on a project said it's a must. Now I did two projects without and everything is nice and simple.
- a13n 9y agoIt's definitely a must after a certain codebase size. 20k LoC maybe? But for personal projects, no way.
- sotojuan 9y ago> Wow, I wonder where people are getting the idea that they need to learn Redux Because everyone with a React job or substantial React project uses Redux (or a similar library). It is common for junior devs to rush through learning libraries in hopes of being employable or a "real developer" as soon as possible.
- ng12 9y agoThe majority of complaints I hear (either at work or online) about React are actually about the React ecosystem -- they have trouble with Webpack or Redux and throw the baby out with the bathwater. I think very few people learn React by writing a pure app (e.g. hand-compiled, no state library). React itself is an incredibly simple library: you can explain the entire thing in a few sentences. In my experience it has an undeserved reputation for being more complex than Vue.
- GFischer 9y agoThe thing is, even if you want to hold yourself to a simple React-only app, the moment you want to leverage someone else's work, you are thrown into the shark-infested waters of the React ecosystem. I think React is very cool, and I haven't tried Vue, but everything on this thread points to it being a much better learning experience, and might be better for small or middle-sized projects.
- SwellJoe 9y agoI've been learning React lately, and many tutorials, even those targeted at beginners, include Redux. Many seem to be a sort-of cargo cult without any understanding of why they're using Redux, and in many cases, there's no reason to introduce Redux into the mix. I've also noticed a lot of tutorials are content marketing from companies wanting to sell bolt-on services and tools, which is pretty weird; I've never used a language/ecosystem that had so many hangers-on before. And, it leads to the same situation: "Learn React (plus these other complicated things that we want to sell you)!" I mean, it's necessary, at some point, to see a full system that uses all the tools for delivering a real application. But, it is definitely a lot of concepts to grok at once. I actually found it most useful to see tutorials that started without even using React, and built up from first principles to what React does (given that React is conceptually very simple, this isn't so crazy...a toy version of React can be built in an hour or so, so it's perfect for a video or article; much of the complexity in React is in making it fast rather than in making it work). But, that may not be a necessary first step for people who have more frontend or reactive programming experience than I have.
- jbreckmckye 9y agoThere is a big problem with the commercialisation of React. More and more companies are using learning resources as marketing material. And now one popular JS developer has started beginning his GitHub readmes with advertisements for a paid JS course. It's a far cry from the open, guileless sharing culture of webdev 10 years ago.
- SwellJoe 9y agoI'm somehow less bothered by the latter. Folks gotta make a living, somehow, and sometimes people have to make choices between doing OSS development or having a real job and doing a lot less of the OSS work. But, the learning materials and marketing are the ones that bug me...especially the ones that neglect to mention that the materials cover React+product, and only mention React in the title. You might not even know it's marketing until you've read half the darned thing and the crux of the thing turns out to be "now create an account here and use this service to outsource the specific thing you googled to learn how to implement yourself". GraphQL has a lot of the same thing going on. It's like "how to draw an owl", only instead of "now draw the rest of the fucking owl", it's "now send us money every month for the rest of your app's life and we'll draw an owl for you".
- acemarke 9y agoI'm a Redux maintainer, and I spend most of my free time answering questions about React and Redux. Yes, since probably early 2016, many tutorials have basically said "you need to learn React and Redux together", and that's the message that a lot of junior devs have been taught. However, my own advice is the same as Dan Abramov's: you should focus on learning React first. Once you understand React thoroughly, then you'll better understand why a state management lib like Redux _may_ be helpful for your situation.
- sillysaurus3 9y agoHowever, my own advice is the same as Dan Abramov's: you should focus on learning React first. Once you understand React thoroughly, then you'll better understand why a state management lib like Redux _may_ be helpful for your situation. That's not really a fair position to take. It basically allows you to believe that React and Redux don't need to be learned together. Put yourself in the shoes of a CTO at a new startup. They need to decide whether to build their company on top of React or Vue. They need to make this decision quickly. Is it really fair to say they don't need to learn Redux? And that maybe Redux won't apply to their situation? Of course Redux will apply, because Redux is for all intents and purposes how you manage state at scale. And everyone who's entering the field who isn't a junior dev is thinking "We need to come up with a way to manage state at scale. Does Vue help us do that, or are we stuck with React+Redux?" It really doesn't help matters when you look into big players like airbnb and discover that they wrote their own state management framework rather than use Redux. They even have a two week onboarding process for new devs that teach them how to write features using their blend of tech. It's a bit... Eh... The whole thing just feels like WPF, a dead technology that few people here have probably heard of. There must be a simpler way.
- ng12 9y ago> Put yourself in the shoes of a CTO at a new startup Okay, how big is our web application? A few pages with a form? We'll avoid Redux for now. We might even avoid React. It's like anything else: should you set up a Spark cluster if you're only processing Gb's of data? Probably not, but you might need it some day -- so make your best guess.
- giobox 9y agoIf you are working with React in a professional setting, Redux is practically the default choice for state management. If you are building something in a professional setting with React, there's a pretty good chance it's complex enough that it needs a state management library like Redux to do well. Almost everyone I know learning React in a professional capacity ends up having to learn Redux at much the same time, my experience is very much the opposite.
- k__ 9y agoFunny thing is, Vue wihtout extras is more complex than React without extras.
- jaequery 9y agono, it's actually quite the opposite. vue took all the complexities out of react/redux it's not even funny.
- k__ 9y agoI'm not talking about Redux.
- sillysaurus3 9y agoThen it's an unfair comparison. Vue does state management out of the box. React really doesn't. Yeah, it has setState, but that's nothing compared to Vue.
- ng12 9y agoI'm very skeptical of that assertion. Can you provide an example of something Vue provides that React does not?
- deleted 9y ago[deleted]
- k__ 9y agoWith Vuex?
- enraged_camel 9y agoNo, he said out of the box. Vuex is not part of Vue core, it's an extra.
- sametmax 9y ago
- fny 9y agoWhat Vue can do is create a well-designed state management library that works out of the box without umpteen lines of boilerplate... and that's exactly VueX. If you love to type, though, I highly recommend Redux! const ADD_TODO = 'ADD_TODO' import { ADD_TODO } from '../actionTypes' function addTodo(text) { return { type: ADD_TODO, text } } dispatch(addTodo(text))
- ng12 9y agoI refuse to believe VueX is any simpler than Redux: https://github.com/vuejs/vuex/blob/dev/examples/counter/store.js https://github.com/vuejs/vuex/blob/dev/examples/counter/stor... Also you don't have to import your actions, it's just a smart thing to do. This gives me heartache a bit: https://github.com/vuejs/vuex/blob/dev/examples/counter/Counter.vue https://github.com/vuejs/vuex/blob/dev/examples/counter/Coun...
- dubcanada 9y agoIt's not, it's literally the same (they said VueX is based on Redux). The difference is React.
- watty 9y agoIt looks like VueX supports async out of the box. That's a huge win IMO.
- ng12 9y agoIs it? I thought Redux abstracting out the thunk layer was silly until that line of thinking lead to Redux-Saga. It actually seems to have been a pretty smart move.
- watty 9y agoThere's vuex-saga as well. Something built in would have been nice because even though sagas are cool, the learning curve is steep enough for me to avoid it in projects.
- dlwdlw 9y agoFrom my experience telling people this doesn't work as everyone thinks they are smart enough to avoid the trap. Like many companies going into China assuming things will be easy. Code ends up complex yet works because the complexity was successfully wrangled, missing the point of complexity reduction rather than wrangling. Thematically, it may be a result of obsession over tools instead of product which occurs in other areas like photography, writing(hipster typewriters), and others. In tech, technology as lever supports a "hacker" mindset of getting 10 for 1. However this misses the point of hacking to get around your weaknesses in order to focus on your core competency which MUST intrinsically have value instead of being an empty shell. The core competency for many client side developers is probably more rooted in a form of design than pure technical ability. Design, like music, writing, speaking, and art have incredibly low barriers to entry. This can create an arrogant mindset from people coming from more rigorous disciplines. Instead of focusing on the thing that must be done, they try to take shortcuts that only have the appearance of reaching the goal.
- sillysaurus3 9y agoOne cure for this is to have someone who cares solely about simplicity, as an ideal above all else, in charge of technical decisions. When you're hyper-vigilant about simplicity, you end up creating the simplest design that meets the goals. It takes a little extra time, but it's so worth it.
- josefrichter 9y agoRookie Vue dev here. I found Vue super easy to understand and to start using for my own simple stuff basically from day 1. Gradually as my tiny projects grew in complexity, I naturally started to feel the need to manage state better. And again, Vue docs led me gradually thru pure-Vue solutions towards VueX. It all felt very naturally, the documentation didn’t push me to anything, just gave me answers at my pace. Can’t say the same about React, even though I’m a big fan of both.
- stevenwoo 9y agoHow are you learning Vue? Looking to expand my toolkit.
- keviv 9y agoInitially, https://www.udemy.com/vuejs-2-the-complete-guide/ https://www.udemy.com/vuejs-2-the-complete-guide/ course helped me to get going. After that, I just read the official documentation and examples on Github.
- kylestlb 9y agoAwesome Vue has a good list of many vue resources: https://github.com/vuejs/awesome-vue https://github.com/vuejs/awesome-vue
- claar 9y agoVue official docs/tutorial are great. I also highly recommend Laracasts free Vue lessons: * https://laracasts.com/series/learn-vue-2-step-by-step https://laracasts.com/series/learn-vue-2-step-by-step * https://laracasts.com/series/testing-vue https://laracasts.com/series/testing-vue
- knowThySelfx 9y agoVue documentation is just superb. Kudos to those wrote it. Evan Yu, in particular. Only those who understand a topic very well can present it so simply.
- jakecodes 9y agoHey ng12, author here. I totally agree with you. I am the biggest proponents of keeping things simple. I initially was hesitant to introduce Vuex. I've written a few huge apps in Vue without anything else but Vue. The cool thing is you can, of course, continue to do that. But again, you just have to follow some strict patterns. Or, to make it simpler, you can get some help from Vuex and let it help you follow those strict patterns. Either way, one is best off if they follow a strict pattern. If not self guided, then library guided. Especially on a big team you can reduce the stress of that strictness if everyone uses Vuex. With so much code flying through GitLab, Vuex is the answer, for quicker code reviews.
- scruple 9y agoI guided my (small-ish) team away from VueX when we reached for VueJS earlier this year in an application. I based these decisions, at least in part, off of the GitLab engineering teams efforts, as well, for what it's worth. We are all still happy wth that decision. I don't have much more to add to the discussion but to say that it's very nice knowing that if we reached a certain level of complexity that we could, fairly easily, introduce VueX and be back at our previous pace without a lot of hubbub.
- jakecodes 9y agoGlad to hear that we influenced your decision.
- supernintendo 9y agoI think one reason for that steep learning curve might be that many aspects of React, namely component lifecycles and state management within components, are abstracted away or simply moot once you start managing state with Redux. Also, while the two libraries work great together (I consider Redux indispensable for new React apps), they aren’t really similar as far as library design and patterns are concerned. Finally, there is something to be said about the mental overhead added by Redux middleware. If you’re dispatching async actions, you’re probably using Redux Thunk. If your app has forms, you might be using Redux Form (I honestly avoid it because its own abstractions and Field components end up getting in my way). Ultimately, the process of learning how to use all of these tools in tandem can feel somewhat disjointed, especially when you’re also integrating them with other parts of the web stack, modern and in some cases legacy. I’ve never used Vue but I’m also curious to see how it and VueX fares in this regard.
- gingerb 9y ago> Redux came out, everyone fell in love with it Not me.
- lxcid 9y agoI agree. It felt like Vue is rewalking the path of React all over again. But I think it’s good that there’s competing library, though the problem domain felt eerily similar.
- hesarenu 9y agoReactjs developers should familiar with other state management libs like mobx or mobxstatetree .