r/learnprogramming • • Apr 11 '21

Dopamine

So recently I came to conclusion that we are constantly stimulated with media, music other distractions that makes it harder to focus and learn programming or anything at all.

I remember that time I had pretty much 0 entertainment no media, no music, limited ability to go out somewhere or talk with someone. After a week or so I found a c++ book, I had attempted learning c++ before, but it didn't make sense, but this time it was different, it was my only source of entertainment, the only escape from reality and learning c++ was just as enjoyable as watching a great movie or listening to music.

I hope this will help someone

1.6k Upvotes

193 comments sorted by

View all comments

Show parent comments

2

u/Smyles9 Apr 12 '21

What exactly about vue makes it seem like it’s clicking better? I’m starting with react and it makes a little bit of sense but it’s definitely hard learning how to use components and jsx when so far my only experience has been with vanilla js. I’m wondering if vue or Angular might be better for me to start.

1

u/corruptedOverdrive Apr 17 '21 edited Apr 17 '21

Jeez man, I'm sooooo sorry, I thought I had responded to you and I never did.

I hope this helps man. . .

The one thing I always likes about Angular was how they scoped their components. It was super easy to create a component: ng generate component <component name> and Boom! You have a component file with your CSS, HTML and TS file where you can set your template, and style urls. React? Naw, you have to do all that manually. Most of the React tuts you see half the tutorial is about setting up your folder structure for your components and getting everything tied together whereas in Angular, you get all that out of the box.

This is one of the key differences between Angular and React. Angular is a full blown framework. React is a view library. You want routing? You have to couple React with React Router - Angular already has a router built in. Http client? Have to add Axios to React. Angular already has it. Yeah Angular has a steeper learning curve than React, but it seemed more straightforward to me for some reason. You didn't have to worry about choosing a particular library to couple with Angular, it had everything you needed right out of the box. For that, yeah its a bigger framework and that will no doubt effect performance, but overall, it seemed more straight forward where you could get up and running faster and create components and have them interact with each other much easier.

Now Vue? For me it was a lot of the same thing. If you already know HTML/CSS and JS like yourself, you'll pick it up really quick. Vue is similar to React in that its just a view library and you have to combine it with other libraries to get a full framework, but for the front-end of things, its insanely powerful.

How to start with Vue:

 <!-- development version, includes helpful console warnings -->
 <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

Create a JS file:

 var app7 = new Vue ({
     el: '#app7',
     data: {
         groceryList: [
             { id: 0, text: 'vetables'},
             { id: 1, text: 'cheese'},
            { id: 2, text: 'whatever elese'}
         ]
     }
 });

Create an HTML file:

 <div id="app7">
       <ul>
              <todo-item
              v-for='item in groceryList'
              v-bind:todo='item'
              v-bind:key='item.id'
              ></todo-item>
      </ul>
 </div> 

Clean separation between markup and presentation. No trying to decode html in js and all that jazz like with React. No need for a thousand NPM modules and build commands. They do have an NPM version, but when you're just starting out, its nice to just have something simple to use and not have to worry about dependencies and build errors. Will it always be this easy with a large scale app? Certainly not, but for me, it just seemed more in line with the vanilla js I have always been used to. This is totally my opinion, Angular and Vue just seemed to click with me better than React for some reason. The Vue documentation is really good IMHO. The Angular documentation can get a little verbose on stuff and you kind of have to wade through it and do some additional googling, but the community is huge and there are tons of articles. The huge downside I've found with Angular is they're putting out full versions every six months. They move so fast. One of the last apps I built with Angular was with Angular 6. That was just about two years ago. Angular is prepping for v.11 right now. In two years they've put out 4 full version releases!! By comparison Vue was on 2.6.3 in 2019. As of this writing (2021) they're on 2.6.11. Yeah, a lot of minor releases, but they haven't gotten to V3 yet so its easier to keep up with the minor changes as opposed to Angular.

Anyways, just my opinion on the basics of why I like Vue and Angular over React. There are many other specific reasons like handling state, but that's for another day. My advice is just keep working with a library/framework you like and stick with it. If React is not clicking, switch to something else. There are SO many options out there. Svelte (https://svelte.dev) is getting a lot of traction so I'd recommend you check it out too.

I hope this helps.