Live data from Hacker News

How we do Vue at GitLab: one year later

about.gitlab.com

41–50 of 208 posts

Re: How we do Vue at GitLab: one year later

#41
post #34

Earlier quoted context omitted.

Then 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.

I'm very skeptical of that assertion. Can you provide an example of something Vue provides that React does not?

[deleted]

Re: How we do Vue at GitLab: one year later

#42
post #30

At my last job we did a comparison between Vue and React before rewriting a major frontend application. We did a POC in both React/Vue and ended up using Vue mainly due to the following reasons: Single File Components Single file components (.vue files) is the best thing about Vue. I understand this might be a personal preference, but we wanted to avoid CSS-IN-JS. Our designer could churn out neat html/css, but was a…

I agree that single file components are awesome. I wish you had been introduced to styled components in react:

  import styled from 'styled-components'

  const Container = styled.div`
    padding: 10px;
    background: ${
      ({ isHovered }) => isHovered ?
        'green' :
        'red'
    };
  `

  const H1 = styled.h1`
    font-size: 15px;
  `

  const P = styled.p`
    font-size: 10px;
  `

  const MyComponent = ({ isHovered }) => {
    return (
      
         Hello 
        

This is a thing

) }

Re: How we do Vue at GitLab: one year later

#43

Earlier quoted context omitted.

I'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 yo…

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. 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 star…

> 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.

Re: How we do Vue at GitLab: one year later

#44

Earlier quoted context omitted.

I'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 yo…

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. 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 star…

If you're the CTO of a new startup, don't pick a technology to build your startup in without building something with that technology first.

Build something small. Learn React. When you're comfortable, and your small app grows in to something a bit bigger that might merit it, learn Redux.

Then, build something small. Learn Vue. Repeat.

Now you understand both options enough to make an educated decision. Feel confident building your big, gotta-get-it-right-off-the-bat startup project in whatever works best for you.

Re: How we do Vue at GitLab: one year later

#45
post #13
post #3

> 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…

What 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))

To be fair, you don't really need to declare your constants elsewhere. This is just a pattern people stuck with, because they're stubborn about constants, I think. Doing a find/replace is so incredibly easy that it's kind of silly to add a bunch more boilerplate to protect against one DRY quip.

Re: How we do Vue at GitLab: one year later

#46
post #9
post #7

Earlier quoted context omitted.

While 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.

Wow, 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

> 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.

Re: How we do Vue at GitLab: one year later

#47

Earlier quoted context omitted.

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. 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 star…

If you're the CTO of a new startup, don't pick a technology to build your startup in without building something with that technology first. Build something small. Learn React. When you're comfortable, and your small app grows in to something a bit bigger that might merit it, learn Redux. Then, build something small. Learn Vue. Repeat. Now you understand both options enough to make an educated decision. Feel confident…

Certainly, and that's the way to do it. My point is, you end up converging on learning Redux. You really do learn Redux no matter what, so it's kind of a myth that you "don't need to learn Redux."

Theoretically, you can get by without learning it. In practice, the moment you try to build a real company, you need it. That necessitates learning Redux.

I think this is an uncomfortable thought because it implies that Vue is way easier for devs to get into, and that's step one to displacing React+Redux. But that seems like an uncomfortable truth.

Whoever is in charge of React needs to give Vue the Snapchat treatment. Take them seriously as competitors. There's still time.

Re: How we do Vue at GitLab: one year later

#48
post #3

> 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…

Hey 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.

Re: How we do Vue at GitLab: one year later

#49
I would strongly disagree that it is ok to use jQuery with Vue. I mean sure, it's ok in that most of the time it isn't going to hurt or break anything, at least if you are just using it to query elements from the DOM.

However, I would argue that is not ok in that it should never be necessary and it's use would be a code smell to me and indicate that the code in question is likely not using Vue properly.

I suspect it would be more valuable in the long term to ask people to take more time and learn to use Vue instead of jQuery to solve the problem at hand.

Edit: I should note that Gitlab came to the same conclusion and I misread their comments on it as accepting the argument that it would be ok for querying the DOM. What the article says:

> At first I had several discussions about using jQuery with Vue. Some had said it might be OK, but only in read-only (querying) situations. However, after doing the research, we found that it is not a good idea to use jQuery with Vue. There will always be a better solution. We found that if you ever find yourself needing to query to DOM within a Vue architecture, then you are doing something wrong.

This I completely agree with.

Re: How we do Vue at GitLab: one year later

#50
post #13

Earlier quoted context omitted.

What 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))

To be fair, you don't really need to declare your constants elsewhere. This is just a pattern people stuck with, because they're stubborn about constants, I think. Doing a find/replace is so incredibly easy that it's kind of silly to add a bunch more boilerplate to protect against one DRY quip.

I'm a really big fan of the Ducks pattern where your action types are private to each reducer unless they're explicitly exported as an API. In my own code I don't even do that, instead exporting a function which operates on the state.

https://github.com/erikras/ducks-modular-redux

Post reply on HN