9
gitpush
6y

I hope I did not make the wrong decision here:
Been working on a side project using React Js for a year now. After getting to know more about Vue, I just started rewriting it and moving it to Vue, to speed things up I'm using core JS classes for network stuff and validations ...etc just rewriting Redux to Vuex and React Components to Vue Templates

If I made the wrong decision I'd appreciate if anyone tell me about it before I go deeper in the rewrite process lol

It is not that I found speed difference both perform the same from what I've seen for my scenarios. But the output code of Vue is soooo much cleaner than what I found in React, either I failed to write a clean react code no matter how hard I try to optimize it, or Vue really takes the short way and keeps things clean.

Comments
  • 2
  • 0
    @sharktits You tried both? or you just happen to like Vue?

    I don't want to waste my time to end up finding the same result, I did make a Vue project but is not as big as the one I'm rewriting now, so don't really know what this will lead, and I hope I don't regret doing that
  • 0
    @J-2FA Thanks man, now if you compare both React and Vue websites of yours, which code is has more potential for maintenance? Improvements? ..etc. from my end, that react website is reaching a dead end soon, that dispatch hell is causing me trouble. Not to forget I used lots o f callbacks either lol
  • 2
    I used bot react and react native in prod, i liked both, but vue was so much faster and less painful to develop with. Maybe just because it doesnt abstract everything away, so its more like writing native js.
  • 0
    @J-2FA aha I see, well I'll just move on with porting it to Vue, React is nice but it can be a bitch in no time lol
  • 1
    @sharktits I understand, that is enough for me, because my project though it is a year old it is considered as a small one, I imagine doing big projects with React will be a pain in the a**
  • 2
    Can people explain why vue is better?
  • 2
    @Hedgepig I'm also looking for that explanation because to me for now it is a matter of clean code, and I found vue to produce a cleaner code than React, unless I'm not doing react the right way
  • 0
    @gitpush I avoid classes like the plague and make excessive use of recompose to create higher order components to wrap around purely presentational components.

    Also I like the look of Redux + RXJS, for action stream manipulation.

    I can give an example if you like
  • 2
    @Hedgepig The thing I didn't like about redux is everything is to be dispatched, sometimes it causes pain to handle it correctly. While in Vue, I have a store module that it does everything then Vuex notify all those that bind to the updated property, no need for a reducer or anything
  • 0
    @gitpush I don't know much about vue, does it have single direction dataflow? That's the real strength of Redux, its very easy to debug state changes and allows easy time travel.

    Anything that isn't part of the global data state and related solely to presentational I keep on the component level in the for of a HOC
  • 0
    Also mutative state can present its own problems
  • 1
    @Hedgepig nope, you can work with data between store and component, but the difference here, is instead of using connect, I simple inside the component do:

    ...mapActions(['MODULE_NAME', 'FUNCTIONS'])

    same applies for state, I don't have to take entire state from the module, I just take the props I will be using inside my component, now we can do that in redux, but in Vue it is as simple as:

    {

    user: state => state.userModule.user

    }

    Bottom line is, all in one file, organized, imagine using connect in the same file of the component, or having to go through many containers ...etc.
  • 1
    I don't think my expertise extends enough to make solid arguments beyond this point, my hunch is this simplicity comes at a cost.

    I think there's an advantage to decoupling action dispatching and reducers with the use of constants.
  • 1
    I think Reacts pure functional presentational components is such a strength, data in, elements out, its just a dsl wrapped around pure javascript, you can map, reduce and use all the goodies functional style presents to you, with high testability, maintainability and composability. From what I read templates don't give you that ability.

    The crux for me is Redux's immutable state, you break everything functional and really raise the probability of headache with mutability.
  • 1
    But I accept not everyone agrees with my point of view.

    Both are acceptable frameworks and your success with them is dependant on (amongst other things) how they fit with your skill set and way of doing things.
  • 1
    @Hedgepig your last comment summarizes it all, tbh me moving to vue doesn't mean no more react, it is just based on current situation which is best to use for solving it.

    For my side project I found Vue to be better, but for another project at work for sure React solves it better.
  • 1
    @gitpush yeah that sounds reasonable.

    I think we can get bogged down and passionate about minor technicals, sometimes it's a good idea to take a step back and go meta about it.
  • 1
    @gitpush meta aside, I am fairly sure there are ways to simplify redux code to better suite your tastes, but I understand if you don't want the faff of configuring something rather than getting what you want out the box
Add Comment