At Codica, we consider Vue.js and ReactJS the most rapidly developing tools for the front-end development for many reasons. While these technologies can help create the same products and applications, both of them have pros and cons.
The purpose of this article is to compare Vue.js vs React.js in different aspects: from general information to technical features. Both these web development tools have mature communities, wide support and popularity, but Vue.js is a framework and React is a library. So, why do we compare oranges and apples?
Why React and Vue? Tools overview
One of the key factors for the comparison between React and Vue was that Evan You, Vue.js framework creator, used ReactJS as a source of inspiration for new framework development.
I figured, what if I could just extract the part that I really liked about React and build something really lightweight without all the extra concepts involved? I was also curious as to how its internal implementation worked. I started this experiment just trying to replicate this minimal feature set, like declarative data binding. That was basically how Vue started. - Evan You
We will start our comparison of the technologies in question with a brief overview. Check the table below to learn the basic info about Vue vs React.
|React and Vue: General Info|
|Creator||Facebook/Jordan Walk||Evan You|
|Syntax||JSX||(HTML (default), JSX|
|Popular websites / apps|
These web development tools are particularly similar to each other. We can behold it even from Vue.js official documentation, where such similarities are displayed. The main initial common points are:
- Virtual DOM;
- Reactive and Component Structure;
- Support of TypeScript;
- Seamless version migration;
- Backward compatibility;
- A great variety of libraries and tools;
- PWA support;
- Flexibility, performance, and speed;
- Big, active communities.
When it comes to the core differences between React and Vue, we should mention the difference in terms. Vue is a framework, while React is a library.
Another difference comes with the approach to rendering content to Document Object Model. While React uses JSX exceptionally, Vue uses HTML templates apart from JSX.
Finally, React and Vue differ in terms of pre-built and third party tools. React comes with competent architecture, DOM manipulation, and component state management. All other functionality is built and supported by the community members.
As a result of this approach, developers get more freedom. At the same time, newbies may find an abundance of third-party instruments challenging.
When it comes to Vue, its widespread tools and libraries are developed by its core team. In addition to them, there are community-based solutions as well.
To conclude, Vue has a more balanced combination of third-party and pre-built tools that satisfies the needs of both experienced developers and newbies.
The most popular applications created with React and Vue
Popular websites created with Vue.js:
Popular websites using React:
Vue vs React: detailed comparison
Let’s dive into other aspects to get better acquainted with React and Vue and compare them in detail.
When choosing the right tools for your web development project, select mature technologies that have already proved themselves.
When using immature tools, there exist certain risks, for example:
- Bugs or vulnerabilities.
- Insufficient knowledge base or small community in case you need help.
As for the maturity of the technologies in question, they were created around the same time. ReactJS was developed and released by Facebook in 2013, while Vue.js was released in February 2014.
As you can see, both Vue and React have been used long enough to become mature tools. During this time, their initial flows were removed and the technologies have been improved significantly.
Popularity and community
So which technology is more popular: React or Vue? To answer this question, let’s check the results of the latest survey State of JS 2020.
Developers satisfaction and interest
Here we can see that React slightly outperforms Vue in terms of satisfaction and interest.
Developers attitude towards Vue and React
Also, developers express their positive attitude toward using both of these technologies:
Most wanted frameworks
Stack Overflow Developer Survey 2021 is also a reliable source of valuable insights into popular technologies.
The recent findings show that React and Vue rank first and second in the list of the web frameworks the most wanted by professional developers.
Most commonly used frameworks
However, if we take a look at the top of the most commonly used web frameworks, we will get a bit different results. React still takes the first place, while Vue lags behind.
Popularity on StackOverflow and Github
Another factor that speaks to the popularity of any given technology is a number of questions asked on professional forums.
The ReactJS community is much bigger than that for Vue.js. However, the main problem refers to React’s fragmentary nature, so it’s more complicated to get feedback on common questions.
On the flipside, Vue is a progressive lightweight framework that allows you to develop solutions easily and fast. Vue.js is also much easier to learn, as it takes less time and the learning curve is much lower. However, it is more complicated to find Vue developers and to get future product maintenance.
Finally, the last criteria for comparing Vue vs React is the number of package downloads. Below you can see the statistics on npm packages download counts over time provided by npm trends:
Development speed and cost
Our experience shows that Vue.js and React have similar development speed. The thing is that there are many additional libraries, frameworks, and packages that help you build the application rapidly. Everything depends on the developers’ coding experience and skills that allow tilting toward ReactJS or Vue, but actually, the time estimates for similar tasks are exemplarily equal.
The cost depends on many factors, such as developer experience and seniority level, location, etc, so it can vary greatly. To have some numbers in mind, we are adding the average cost from the Codementor platform for both React and Vue.js.
ReactJS developers average rates:
Vue developers average rates:
React provides a third-party CLI tool called create-react-app that helps developers accelerate such work aspects as application development, adding scripts, and installing necessary dependencies.
Before create-react-app was released, developers had to copy the Webpack-config and other .rc files from previous applications each time they started a new application, or configure everything manually. Without using create-react-app, you had to put the same configuration from one project to another. It did not take much time but was actually boring.
The create-react-app provides a CLI interface for building applications with a basic structure, it installs all the necessary dependencies, and adds scripts to the package.json to run, test, and build the application.
Indeed, ReactJS gains huge support for the main IDEs.
Vue-cli is a tool for quick project creation for Vue.js. Such projects have a ready-made structure, an installed configuration, as well as a number of basic files.
The main advantages of Vue-CLI:
- No blocking, plugins can be added anytime during the development lifecycle.
- Thanks to plug-ins with no settings, you can spend more time on development instead of customization.
- Easy to improve, since adjustment can be customized without “outliers”.
- Allows developers to create their own plugins and templates.
React centres around UI, so initially, you get the help in building UI components.
However, ReactJS does not provide you with state management. When you are dealing with React applications, you need to use Redux as a state management tool. To date, MobX is also gaining popularity as a ReactJS associate.
Moreover, speaking about React router - it is not an official package, but also a third-party one.
You may also like: The Power of CSS Processors in Web Applications Development
As a dynamic framework, Vue.js permits simply utilizing its most basic tooling to create an application, however if necessary, it additionally offers the vast majority of all the functionalities that you may require:
- Vuex for state management.
- Vue Router for application URL management.
- Vue.js Server-Side Renderer for Server-Side Rendering.
Vue is more intuitive than React both for small and large applications.
If you’re wondering how to implement these Vue tools through a real-world project, we recommend reading our article How We Built a Slack Bot for Time Tracking with Vue.js and Ruby on Rails.
Further reading: How to Make a React Progressive Web App Application (PWA)
This approach is widely used for delivering mobile experience to users by the world’s best businesses, including Alibaba, Twitter, and others. Speaking about our experience, we have successfully delivered multiple PWA solutions for many domains, including insurance, recruitment, ecommerce development and others.
Here’s an example of a Progressive Web App for an activity booking platform, built with React and Ruby on Rails:
In fact, almost all of the products that Codica Team delivers are PWAs. This not only saves time and cost for MVP development, but also provides a solution which is fast and optimised for search engines.
- NativeScript has direct access to native platform API.
To compare the popularity and developers’ community usage of Vue vs React, let’s take a look at Google Trends Chart. It displays the data for the past 12 months.
To conclude, React Native is much more popular and used in the developers’ community that means a bigger amount of ready-made solutions are available for mobile development.
Generally, both Vue.js and React.js implement the same component approach in development when you have one file for one component. There are still some different aspects interesting to discover.
He points out that the separation of patterns and logic is simply a technology division, not a responsibility. You must create components instead of templates. Components are reusable, integrable, and convenient for unit testing.
JSX is a great advantage for development, since you will have everything in the same place, and autocomplete and checks at the compilation stage will work faster. When you make a mistake in JSX, ReactJS does not compile the code and displays the line number in which the error was made.
Further reading: Deploying a Static Website on AWS Web Hosting with GitLab CI
Vue offers “single-file components”. This is like a compromise regarding the division of responsibilities - templates, scripts and styles are not in one file, but in three different, ordered sections. This means you get syntax highlighting, CSS support and the ability to easily use preprocessors like Jade or SCSS.
Various sources state that JSX is easier to debug because Vue does not show syntax errors in HTML. This is not the case since Vue.js converts HTML into render functions - therefore errors are shown without problems.
Examples of component structure
Let’s get acquainted with the same component created for a To-Do List application both in React and Vue to see the difference between ReactJS JSX and Vue.js templates.
Vue component structure:
React component structure:
Vue vs React performance
To check the ReactJS and Vue.js performance, we turn to a great js-framework-benchmark that helped to compare both frameworks’ performance.
Duration in milliseconds ± 95% confidence interval.
|Vue and React Performance Comparison|
Create rowsDuration for creating 1000 rows after the page loaded
|187.6 ± 4.3||169.2 ± 3.6|
Replace all rowsDuration for updating all 1000 rows of the table (with 5 warmup iterations)
|165.2 ± 7.0||161.8 ± 3.9|
Partial updateTime to update the text of every 10th row (with 5 warmup iterations) for a table with 10k rows
|93.6 ± 5.6||168.1 ± 7.4|
Select rowDuration to highlight a row in response to a click on the row (with 5 warmup iterations)
|12.4 ± 4.1||9.8 ± 2.5|
Swap rowsTime to swap 2 rows on a 1K table (with 5 warmup iterations)
|19.6 ± 4.7||21.8 ± 4.5|
Remove rowDuration to remove a row (with 5 warmup iterations)
|51.5 ± 2.0||52.5 ± 1.8|
Create many rowsDuration to create 10,000 rows
|2033.7 ± 32.0||1521.4 ± 55.7|
Append rows to large tableDuration for adding 1000 rows on a table of 10,000 rows
|271.8 ± 9.9||338.4 ± 10.3|
Clear rowsDuration to clear the table filled with 10.000 rows
|224.4 ± 6.0||240.9 ± 11.4|
Startup timeTime for loading, parsing and starting up
|49.4 ± 0.7||48.4 ± 2.4|
To summarize, React has excellent performance, but both ReactJS and Vue are pretty close to each other, compared to particularly slow or especially fast development tools (like Inferno).
In general, both web development tools have similar approaches in managing the components’ state but still have some differences in immutability and other aspects. Let’s consider all of them.
It is difficult to create UIs, as states are present everywhere — data changes over time, which entails an increase in complexity. Certain ways of working with the state are of great help when the application grows and becomes more complex. For small applications, this might be a brute force, and something like Vanilla JS would be enough.
How does the state management work? Components describe a UI at a specific point in time. When data changes, the framework redraws the entire UI component - the data displayed is always relevant. We can call this idea “UI as a function”.
In other words: the application state is entirely in the object tree inside the unified storage. It helps to debug the application and some functionality becomes easier to implement. The state is in read-only mode and can be changed only through actions to avoid a race condition (also useful for debugging). Reducers are created to indicate how actions can transform a state.
Generally, React is used within some kind of data flow library for applications. Redux is the most popular choice. A similar Vue data flow library is called Vuex. Indeed, the transition from Redux to Vuex is virtually painless, since the two libraries have much more in common than ReactJS and Vue.js themselves.
React is often paired with Redux. Redux describes itself in three fundamental principles:
- The only source of truth
- The status is read-only
- Changes are made using pure functions
The main difference is that Redux relies heavily on state immutability, due to the fact that Redux was created considering ReactJS. However, it is recommended to avoid mutating values that you use as a prop or state to optimize React performance.
Within a component’s stage change, it starts re-rendering a component's entire subdirectory, beginning with root rights. To avoid unnecessary reruns of child components, you need to use React.memo(). With the help of this higher-order component, you can skip unnecessary rendering, provided that the props remain the same.
You may also need to use immutable data structures to make state changes more optimized.
Further reading: React App Development: UI, Styling, State Management, Testing
In contrast, Vuex does not care about the immutability of the state.
In Vue, the dependencies associated with the component are automatically tracked during rendering, so the system knows exactly which components should actually be re-displayed when the state changes.
This leads to several differences in the way ReactJS and Vue.js components interact with the repository, and we would like to tell you more about it.
Redux data flow is fairly strict and simple. The component dispatches an action that is returned by the action creator. Then the reducer generates a new state based on what the action wants it to do. Finally, the component monitors store changes from the repository and can get access to the store using useSelector hook.
Every action goes through the action creator. Although it is theoretically possible to fire an action directly from a component, it rarely happens. The syntax of the action prompts us to encapsulate logic in the functions of the action creator, even in the case of the most trivial actions.
Recommended reading: 4 Useful Git Commands That Will Make Your Life Easier
Although the data flow in Vuex is quite similar, it is not as strict in the number of ways a component interacts with a state. First, the component can send an action. This is usually used to create asynchronous files, such as fetching data from the source code.
After that, the action makes a mutation. The mutation function, similar to the reducer, is the only one allowed to change the state. However, there is another way: a component can make a mutation directly, and sometimes it is very tempting to reduce the data flow, completely discarding actions.
To conclude, state management is the main difference between React and Vue.js. Vuex, like Redux, is a library whose creators were inspired by Flux. Unlike Redux, Vuex changes state instead of making it immutable and replacing it completely, as with the Redux reducers.
This allows Vue to automatically retrieve the data which alerts to be re-rendered when the state changes. Instead of using specialized reducers, Vuex allows you to organize the application state management using storages called modules.
Storage data reception
Utilizing storage, we can use the same data multiple times in different application parts which is of great importance. This way we do not need to create the same function each time we want to get access to the component’s data.
Currently, you can extract data from Redux store with the help of useSelector hook. It accepts a single function that we define as a selector function. This function takes the whole Redux store as its argument, interprets some value from its state, and gives that result back.
Even though the array might contain the exact same object references each time, the array itself is a different reference, so the shallow equality check fails and React Redux would re-render the wrapped component.
Although if you use it only for the top components, you will lose the number of details that you have to pass down to restrict access to them. In fact, even with a reasonable amount of container components, the number of details that you skip down remains quite large.
Within Vue, you don’t even need to think about it. The storage is available from each Vue component:
This means the number of details that you actually transfer from one component to another is rather limited and is only required for data that is not stored in the repository. This is pretty reasonable, given that passing props to Vue has a very awkward syntax:
Despite the fact that the transfer of props in Vue is more inconvenient, the storage is available in each component. The quantity of requisites that you really have to pass is rather insignificant compared to ReactJS. Even with a sufficient number of container components, the amount of details that receive an intermediate component is quite large.
You may find it interesting: How We Created a Multi-site Setup for a Vehicle Marketplace.
React vs Vue: comparison summary
Future maintenance and customization are much easier through the community volume. There are a large number of contributors and developers ready to build any application. Their total amount is greater than that of Vue.
Another reason to opt for ReactJS is a huge amount of libraries and tools that simplify and accelerate the development process. There is no need to write a function from scratch while the ready-made solution is available.
Recommended reading: Top Programming Languages to Shape Software Development.
On the flipside, Vue.js is a good choice in case you are interested in creating lightweight and easy-to-fix applications. The learning curve is lower. It allows mastering the framework in a short period of time and entering upon the application development.
The Vue community is smaller than React but it is growing at warp speed. Subsequent to contribution volume, the number of tools and libraries available grows as well.
Check our GitHub repository on Vue app best practices.
To sum up all the pros and cons, let’s have a look at the Vue vs React comparison table.
|React and Vue: Summary|
|Maturity||Developed by Facebook in 2013, 174200 stars at Github||Developed by Evan You in 2014, 187800 stars on Github.|
|Community||331,000 questions on StackOverflow||83,400 questions on StackOverflow|
|Tooling||Third-party CLI - create-react-app||Official Vue-CLI|
|Flexibility||React does not provide you with state management out of a box. React router is a third-party package, not official one.||Vue provides you with state management (Vuex), Vue Router for application URL management, Vue Server-Side Renderer.|
|Storage Data Reception||More convenient syntax, but a large number of the details you skip down, and you cannot utilise the useSelector function very often.||Despite awkward syntax and inconvenient transfer of props, storage is available in each component, and the number of requisites that you have to pass is rather insignificant.|
|Development speed and cost||Depends on the task||Depends on the task|
As we can see, both Vue and React have powerful tools and features that help us in web development. However, while choosing what to adopt you need to bear in mind those differences presented in the table to make the right choice.
When to choose React or Vue?
Both web development tools can be implemented for any needs and requirements. You can build web applications, single-page applications, and user interface components with their help.
Here is the comparison table considering different factors to choose ReactJS or Vue.js:
|When to choose React or Vue|
|Like large ecosystems|
|Like really clean code|
|Want the simplest learning curve|
|Want the most lightweight framework|
|Want a division of responsibility within one file|
|Develop an application that tends to grow|
|Want to access a larger community of developers|
|Work with designers and need pure HTML files|
To sum up, both Vue and React are powerful tools for creating complex web solutions. They can provide you with a great number of possibilities to solve tasks of any complexity. Whatever you choose - you cannot go wrong!
At Codica, we are great fans of React and Vue technologies and have built many custom solutions with their help - from a Travel booking marketplace to an Accommodation search platform. Check our project portfolio to learn more about works we deliver with React and Vue.
By the way, we are hiring! Join our expert team and help us deliver awesome web products for end users all over the world. Check our open positions and let's talk!