
The creator of Vue.js meets Habr

All with Friday!
As promised, we publish Evan You’s answers to questions that we have
In general about Vue
Q: What is the most unique killer feature of Vue.js?
O: Progressive adaptability: you can use it as a replacement for jQuery or create applications of any complexity using the CLI, router and Vuex.
Q: What are the weaknesses of Vue?
O: At the moment, probably unfriendliness towards typing. Our API was developed without planning support for typed languages (such as TypeScript), but we made big improvements in 2.5.
Q: React calls itself a library, Angular calls itself a framework. Why does Vue position itself as a framework?
O:“Progressive framework” means that it can be used as a library OR as a framework of your choice. We have parts of the framework (CLI, router, state management patterns), but no one forces them to be used if they are not required. (see more detailed video (eng) - approx. per. )
Q: Is Vue a full replacement for React / Angular or is it a niche framework?
O: Yes, it can be a complete replacement. This is not a niche framework.
Q: What is the expected life cycle of Vue.js? Will Web Components / VanillaJS be able to replace JS frameworks in the near future?
O:We are growing pretty fast and are now in a relatively stable / mature state. No, I don’t think Web components will ever replace frameworks. They are only low-level building blocks. Even if you use them today, you are most likely forced to use Polymer, which * is * a framework over Web components. It has its own additional APIs, patterns, libraries and tools. The advantages of Web components are mainly in compatibility between frameworks or third-party packages (3rd party distribution). Inside the application, they do not give anything new in comparison with existing models of components (in fact, they can be less). VanillaJS only makes sense if you can afford to spend an eternity developing a project.
IN:What is Vue's policy regarding deprecation, incompatible changes, and backward compatibility?
O: We follow semver . We can declare features obsolete in minor releases, but in fact they will not be deleted, so your application will not break. We are quite cautious about major versions / incompatible changes and do not plan them in the near future.
Q: What is the recommended code structure for Vue: OOP or FP / Declarative approach?
O: Neither the first nor the second. I think it makes no sense to pull high-level paradigms on UI code. Choose good ideas from both. But if you really want to choose the Vue side, then I think there will be a little more OOP.
IN:Forms are a strong trait in Angular and weak in React. How does Vue work well with complex forms?
O: Vue has a built-in two-way binding (v-model), which is very similar to Angular's ngModel. It is also possible to build Angular-like validation libraries on top, and several already exist in the ecosystem.
Q: What are the biggest Vue competitors in China?
O: React and Angular are very popular in China. In addition to them, in fact, there are no others.
Q: It is rumored that Vue determines that the benchmark is running, and specifically overestimates the test results (hello, VolksWagen!) Your comments?
O: Rumors without evidence remain only rumors;) The Vue.js code is publicly available, so if there is such a code, it can be easily found.
Third party tools
Q: What are the prospects for Weex? Should I start working with Weex now? Or is it better to concentrate on working with NativeScript-Vue?
O: Weex is a reliable technology, because It is widely used inside Alibaba. Simply, unlike others, they do not allocate a lot of resources to documentation / developer support. NativeScript-Vue has the best documentation and developer feedback. I will not give unambiguous recommendations, because your choice should be determined by the team / product / environment. To find out the full potential of these technologies, you need to try both.
Q: What do you think of Nuxt?
O:Nuxt is a great thing. If you need an SSR for Vue, use it if you don’t want to configure everything yourself (there are also framework-independent alternatives like Razzle - approx. Per. )
Q: What do you think of the Quasar Framework for Vue.js as an analogue of ReactNative for React.js ?
O: No. Quasar is more like Ionic for Vue, as it is based on Cordova / WebView.
Q: What do you think about integration with Logux and distributed data types in general? Is the next revolution planned here?
O: Unfortunately, I am not familiar with Logux.
Q: Will there be support for the Kotlin programming language in Vue (SFC, plugins, etc.)?
O: I am not aware of anything like that.
Documentation
Q: The examples in the official documentation of Vue.js are not always clear due to the fact that they cannot be run directly on the page. What are plans for integrating CodePen or JSFiddle into Vue.js official documentation?
O: Good suggestion. Perhaps we will consider it when we have more time.
Q: How to divide a page layout into components before starting development? Is there something like Evan Yu's “Component Criteria List”?
O: This is not possible, all applications are different.
Q: Is there a single, formal style guide like Angular by John Papa?
O: ru.vuejs.org/v2/style-guide
In:Are there official instructions for migrating to Vue from other frameworks?
O: This question is difficult to answer without knowing which technologies are migrating from.
Q: How to turn a Vue application into a Web Component?
O: Using the vue-cli version 3 console utility
Q: In the official Vue.js documentation, the recommended TypeScript compiler option is “module”: “es2015”. How acceptable is the use of "module": "amd", "module": "system".
O:This recommendation is based on the assumption that an ES module compatible packer such as webpack or rollup is used. Personally, I no longer use AMD or System, so I can not answer this question. My general suggestion is do not use them unless you know what you are doing. Since you still ask this question, use the mainstream (i.e., the default settings - approx. Per. ).
Q: When will the AST build specifications for templates be released?
O: I do not think we have such plans. We will need a very convincing use case to consider such a solution.
Feature Requests
Q: Will it be possible to use a single-file component compiler without modular bundlers?
O: Yes, we have a SFC (Single File Component) compiler, we hope that it can be used to create external or intra-browser compilers.
Q: Will a library generation template be added to vue-cli?
O: vue-cli 3 can also be used to create libraries .
Q: Fragments from React version 16.2 have worked well. Will there be something similar with Vue.js?
O:Yes, although not in the near future, because many changes will be required in the current diffing algorithm. React needed to completely rewrite everything for almost 2 years.
Q: Will Vuex support middleware processing between actions and mutation?
O: Unlikely. Most likely, we will get rid of the differences between actions (mutations) and mutations (mutations).
Q: When will running the `npm run lint` command support autofix?
O: vue-cli 3 already supports this. You can also change the command yourself by adding the `--fix` flag.
IN:React recently released aka Fiber asynchronous rendering. What will be Vue's answer? Is Vue still the fastest of all three frameworks?
O: Async does not make React faster. It is only used in certain scenarios to prioritize updates for better visible performance. The Vue update engine already has the ability to simulate some of these scenarios, but we need to open the corresponding API to make their use simple.
In short: we do not plan to create the full Fiber equivalent, but we will provide an API for some of the innovations that have appeared in it.
Q: Will Vue.js add the ability to render the same slot in a component twice as React allows?
// [Предупреждение Vue]: Duplicate presence of slot "default" found in the same render tree - this will likely cause render errors.
...content
...content
...content
// в React работает без пробем
...content
{this.props.children}
...conent
{this.props.children}
...content
O: Although React allows this, I don’t think it is a good idea.
Q: Does Vue support a single repository for enterprise-scale applications like Nrwl Extention in Angular?
O: This is the problem of organizing the project, it is still outside our interests.
Please recommend
Q: Now Vue.js can perform form validation in two different ways:
- declarative, when all the rules are described as directives in the markup;
- imperative, when all the rules are described in the code of the corresponding Vue-instance
Is it planned to make any of these methods the default implementation in Vue.js? Or both ways at once?
O: No, because it is better to have several competing solutions to a controversial problem.
Q: How and what is the best way to test Vue? Avoriaz recommends switching to vue-test-tools, but the latter is still beta.
O: @ vue / test-utils will replace Avoriaz. Use @ vue / test-utils.
IN:The Vuex state is reactive / observable, like any given Vue component. If not for the legacy of Flux, would it be possible to manipulate it directly (even if it is a bad idea)?
O: If you need a reactive state of the repository that can be manipulated directly, just use an unmounted instance of Vue.
Q: Are there plans or recommendations for components for returning multiple root nodes? Is such a list-based approach possible, even in theory?
O: Yes, we are planning this, but it will take some time.
Q: What are your ideas on reusing, inheriting, and tuning components during startup? Are there any proven approaches and solutions?
O: Sorry, but this is too big a topic to answer here :)
Community
Q: Vue has absorbed a lot of Angular and React chips. What is Vue's relationship with the Angular and React communities?
O: Actually, I communicate quite often with the React community. I like all their good ideas. However, I am not familiar with so many people from the Angular community.
Q: I want to contribute to the development of Vue. What areas do I need my help in?
O: Start answering others' questions! This can be discussions on GitHub, chat in Discord or StackOverflow (or Toaster - approx.) It must be remembered that the answer must be as clear as possible. Usually, in order to better understand the problem, you may need to reread the documentation or even the source. Having been doing this for a while, you will begin to understand Vue much better and will be able to solve more problems on Github by helping with code examples, finding sources of bugs, and even creating fixes and new features.
Q: What are the largest Vue conferences, meetings, and events worth visiting?
O: We just had a Vue.js conference in Amsterdam this past February. And we plan to hold it there next year. Also in March this year will be the VueConf conference in the US. A lot of conferences are held all over the world - you just have to look near the place where you live ( Vue in Moscow- approx. trans. )
Future plans
Q: Is there any work on Vue 3.0? If so, what are the key changes?
O: We have plans for 3.0, but so far nothing is certain. The next big release is the 2.x-next branch, which is fully compatible in features with 2.x, but in it the internal reactivity system has been rewritten to ES2015 Proxy . This will improve performance and allow you to get rid of some of the limitations of the existing implementation (for example, tracking changes in objects and arrays - approx. Per. ). We will stop supporting IE11 and lower, but let us use the latest ES2015 features for more efficient code.
IN:Access to parent components (via $ parent) allows inexperienced developers to make terrible mistakes. What do you think about this? Do you plan to ever remove such access (for example, in version 3.0)?
O: It is unlikely that we will remove it, since it can be useful in certain situations. You can always deny access to a parent using static analysis, for example, using a custom rule for ESLint.
About myself
Q: Let's move away from IT-related topics. Summarizing your experience, what knowledge can you share? What are your interests and how do they fit with programming? What advice would you give to people in general and developers in particular?
O: I have an art education, I studied programming, for the most part, on my own. Probably because of this, I tend to appreciate practical and easy-to-learn solutions. Over time, I also realized that more often than not, programming is about choosing the right compromises. I think my advice should not be too categorical - be practical and be prepared for compromises.
Q: How many hours a day do you devote to working on Vue.js?
O:Since it became my main job, I spend a normal average working day from 9 to 5 (well, maybe a little longer)
Q: Tell me about your past experience with Google, Meteor, etc. How was the idea of Vue born?
O: I just finished an episode of a podcast that will be available soon on devchat.tv. There I talk about it in detail.
Q: What, in your opinion, is the most important moment in the stack of web technologies for today? In what areas is the need for change? What is in order and what is not?
O:I can only talk about the front end. I think the main problem is that the standard APIs that the web platform provides are too low-level. As a result, so many libraries solve almost every problem that the platform does not solve. This is both good and bad. The good thing is that these innovations (caused by competition) generate great ideas. The negative side is that almost every stack that you see consists of a huge number of rapidly developing dependencies. This is likely to continue for several more years.
Personally, I hope that one day browsers will become effective enough, and we can stop worrying about bundling or micro-optimizing the delivery of assets. This will remove all the problems with the temporary (stop-gap) tools that are usually found in today's front-end architectures. However, I do not know when this will happen.
Q: Which technical solution in View are you most proud of?
O: I made it easy to learn and at the same time quite powerful.
Q: Tony Hoare called null a billion dollar error. What was the worst technical decision of your career?
O: It would be nice to use TypeScript initially, even when I started rewriting code for Vue 2.x.
IN:What is the most difficult Vue feature you've worked on?
O: Probably the optimization of server rendering in 2.4, which allowed the renderer to process a mixture of VDOM nodes and string representation nodes created during compilation.
PS
Thanks to everyone who helped with the organization and translation (Alex Sokolov, ai_boy , hiperteksto , irsick , z6Dabrata , gbezyuk ) and, of course, to Evan himself.
PPS
See the video (eng) of our previous Q&A session with Evan