4 ms·
Nice! I've recently tried to get into React seriously and I found myself getting stuck pretty quickly. I tried Vue.js which seem to be popular as well and I had
by baby 9y ago
Nice! I've recently tried to get into React seriously and I found myself getting stuck pretty quickly. I tried Vue.js which seem to be popular as well and I had a blast. I found the templates more intuitive, the documentation easier to read and the concepts just fun to use. I ended up spending the entire week just playing with Vue.js and making an app with it.
I was wondering what was HN's opinion on the framework. And knowing js, if I was just once more learning a soon-to-be-dead framework and I should just insist with React.
- nicoburns 9y agoI think Vue is probably safe as a technology to learn. It's definitely the 3rd framework now (behind React and Angular 2+), but it has a lot of support, notably from Laravel which has a huge community of it's own, and from many who quite justifiably find React/Angular2 overly complex. It's also the case that Vue, React, and Angular 2 are in many ways more similar than they are different, so experience with one will be helpful if you ever need to move to using another. Finally, at some point I would advise you to take serious look into understanding webpack and babel and/or typescript and how to configure them. Webpack might be 'just' the build tool, but it is the common underpinning of pretty much all frontend development, and a lot of the complexties become a lot more managable once you understand what it is doing.
- baby 9y agoAny good resource on understanding webpack?
- acemarke 9y agoYes. The official Webpack docs [0] have been revamped, and are now pretty good. The "Webpack Tutorials" section of my links list [1] points to many more useful articles. I'd specifically suggest the "Webpack from First Principles" video [2] and the "Webpack: It's Not Magic" slides [3] Also, Sean Larkin, one of Webpack's maintainers, has put together an online course site called "Webpack Academy" [4]. I believe the intro "Webpack Core Concepts" course is free. [0] https://webpack.js.org/ https://webpack.js.org/ [1] https://www.youtube.com/watch?v=WQue1AN93YU https://www.youtube.com/watch?v=WQue1AN93YU [2] https://www.youtube.com/watch?v=WQue1AN93YU https://www.youtube.com/watch?v=WQue1AN93YU [3] https://naomiajacobs.github.io/WebpackTalk/ https://naomiajacobs.github.io/WebpackTalk/ [4] https://webpack.academy/ https://webpack.academy/ A short explanation is: you tell Webpack which file is the "entry point" to your application. It then recursively traces all the imports from there, creates a dependency tree, and bundles all those individual files into a single output bundle. You can also configure it to transform files along the way, allowing you to compile newer JS syntax into older syntax with Babel, import images and styles into your JS bundle, and much more. It also allows you to set up code splitting so that common code shared between different bundles is extracted into a separate bundle file, and parts of your app can be dynamically loaded after the initial app starts up.
- andrewtbham 9y agoFor me learning vue was much easier, cuz I knew Angular 1... React was harder to learn, but I find myself making more components than I did in Angular and Vue. React delivers on the idea of making reusable components accessible.
- colordrops 9y agoI'd recommend plain vanilla web components [1] and a templating engine, something like lit-html [2]. All custom frameworks end up getting crufty and unmanageable, and React is already there. Try web standards and single-purpose libraries, following the Unix philosophy. [1] https://developers.google.com/web/fundamentals/web-components https://developers.google.com/web/fundamentals/web-component... [2] https://github.com/PolymerLabs/lit-html https://github.com/PolymerLabs/lit-html
- dmitriid 9y agoI have no idea what Unix philosophy's got to do with Web Components, but your advice is terrible. You're dissing custom frameworks at the same time as you're advocating using a custom framework. Or, as you call it, "a templating engine". Because you need much much much more than just a templating engine: - Web Components provide a fraction of a fraction of React's capabilities. Even though React doesn't even have that many capabilities. After all, it's just the V in MVC. - You still need data binding - You still need state management - You still need ways to deal with component hierarchies (good luck not forgetting to unbind all the event listeners etc.) - You still need to re-implement your own forms [1] - etc. etc. etc. So what you really are proposing is: either use a framework/a bunch of helper libs (Polymer, Skate.js whatever) or end up getting crufty and unmanageable with the low-level DOM APIs that Web Components offer (there are no other APIs in the standard). [1] There is no way to have custom elements include data in form submissions: https://github.com/w3c/webcomponents/issues/187 https://github.com/w3c/webcomponents/issues/187 and the solution is "to replicate the behaviour of form elements (which requires you to also to replicate <form />)" https://github.com/w3c/webcomponents/issues/187#issuecomment-298679090 https://github.com/w3c/webcomponents/issues/187#issuecomment...
- colordrops 9y ago> I have no idea what Unix philosophy's got to do with Web Components. From Wikipedia: The UNIX philosophy is documented by Doug McIlroy in the Bell System Technical Journal from 1978: * Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new "features". * Expect the output of every program to become the input to another, as yet unknown, program. Don't clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don't insist on interactive input. * Design and build software, even operating systems, to be tried early, ideally within weeks. Don't hesitate to throw away the clumsy parts and rebuild them. * Use tools in preference to unskilled help to lighten a programming task, even if you have to detour to build the tools and expect to throw some of them out after you've finished using them. I'd say that the first, second, and fourth are EXACTLY what web components provide. Furthermore, things like Angular and React that include the kitchen sink are precisely the antithesis of the Unix philosophy. And lit-html does only one thing and does it well. It is not a framework. > Web Components provide a fraction of a fraction of React's capabilities. That's a pretty empty statement. > You still need data binding Which is why I suggested adding lit-html > You still need state management React doesn't include this either. I would suggest redux, or even something hand-rolled, considering how simple redux is. Even Dan Abramov, the creator of redux, suggests rolling your own unless you really need it. > You still need ways to deal with component hierarchies (good luck not forgetting to unbind all the event listeners etc.) lit-html handles this > You still need to re-implement your own forms See: https://www.webcomponents.org/ https://www.webcomponents.org/ for countless form components. > etc. etc. "etc" is used when you've run out of ideas. > There is no way to have custom elements include data in form submissions. You would be adopting a new technology with web components. Why bother with old-school form submissions? You are very ignorant and come off as seriously aggressive for no reason. Do your homework.
- acemarke 9y agoAny particular aspects of React that you found confusing? Be happy to answer any questions you might have. Also, my React/Redux links list [0] points to a wide variety of tutorials, articles, and resources for learning React. In addition, I'd encourage you and anyone else to come by the Reactiflux chat channels on Discord [1]. They're a great place to learn, ask questions, and get help with React and related technologies. [0] https://github.com/markerikson/react-redux-links https://github.com/markerikson/react-redux-links [1] https://www.reactiflux.com https://www.reactiflux.com
- hesarenu 9y agoIf you know javascript react is very simple. Just few life cycles to learn rest is plain javascript. Consider that in Vue, angular you need to understand their own language for simple things like looping, if logic etc. With react you can get far with state then you can look into mobx,mobxstatetree,redux.
- zmmmmm 9y ago> Just few life cycles to learn rest is plain javascript People say this but I feel like it's disingenuous: real world experience with JSX is that you need to master a whole slew of special constraints / restrictions and exceptions before you are using it efficiently. It is effectively learning another language with about the same complexity as the template constructs in Vue.
- hesarenu 9y agoI disagree. I was able to pick up reactjs in a day. And have been working on it for nearly 2 years from small to large codebases. I have just glanced vuejs but I am learning angular because of work project. Angular is way more complex then react. There are so many special tags to learn which is similar to vuejs tags from looking at the doc. What you need to matter in react would be JavaScript itself.
- baby 9y agoWhen I was trying to learn React it was really difficult for me to find out how to write html using jsx. Everything has a different name and different ways of being written. Another thing that helped with Vue.js that I did not find when I was learning React are laracast classes
- hesarenu 9y agoYou should think in terms of components not html. You would be combing simple components to create more complex components. As far as names i find vuejs more complex. I have years of experience in js. Vuje requres me throw many of those to write simple loops, if logic even onclick binds etc. For me at least reactjs is a simple framework.