If we look at Vue.js and ReactJS, at Codica we consider them as the most rapidly developing tools for front-end development for many reasons. We create various products using both Vue and React for multiple tasks. While these development tools 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 and ReactJS in many various 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 Vue and React?
One of the key factors for the comparison 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
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
At first sight, both Vue and ReactJS have more similarities than differences. Let’s dive into other aspects to get more acquainted and compare the tools in detail.
Analyzing the project development and trying to decide what should be used as an instrument to gain the result, you need to be careful while choosing the tools that have not yet matured or approved themselves.
When using immature tools, there exist certain risks:
- Bugs or vulnerabilities.
- It might not have a big knowledge base or community in case you need help.
Vue.js and React were released by a huge corporation and an experienced developer respectively, which give us the confidence of stability and huge community support in case we need a helping hand.
Let’s look at some facts, to begin with:
|React and Vue: General Info|
|# Contributors on GitHub||1271||100|
|GitHub Stars Rating||117.500||122.000|
ReactJS was developed and released by Facebook in 2013 and is still being implemented in their own products like WhatsApp and Instagram. It is one of the most popular JS frameworks on GitHub with about 117,500 stars at the time of writing.
Vue.js was featured in February 2014 by Evan You, a former Creative Technologist at Google. Evan was responsible for UI/UX prototypes and creative experiments at Google Creative Lab in 2012-2014 and was working with React and Angular. Afterwards, he summed up his thoughts on these frameworks and created a fully lightweight framework within the same functionality.
Up to date, Vue is also one of the most popular frameworks to adopt in web development with 122,000 stars on GitHub.
Here is the GitHub Stars comparison history.
To conclude, Vue.js and React have mature history, support and popularity among developers’ community. All this brings an interest in comparing them from a technical side to discover the key differences in the development process.
Subscribe to our newsletter to get valuable insights from our experts.
Community and popularity
On StackOverflow, there are 115.900 questions within #reactjs. Moreover, about 50.000 npm packages are available for React developers at the moment of article writing.
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 which allows you to develop solutions easy 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.
Speaking about Vue.js popularity, there are about 27.000 questions on StackOverflow within #vue.js and about 14.000 npm packages available for Vue developers.
Development speed and cost
Our experience shows Vue.js and React are particularly similar in development speed as 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 the 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 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 to 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.
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 about creating a time-tracking Slack Bot with Vue.
- NativeScript has direct access to native platform API.
To compare the popularity and developers community usage of both frameworks, let’s get acquainted with a State of JS 2018 Chart.
Also, here is a Google Trends Chart displaying the comparison table of React Native and NativeScript for the past 4 years.
To conclude, React Native is much more popular and utilizable in the developers community that means a bigger amount of ready-made solutions are available for mobile development.
Related reading: Progressive Web App vs. Native Apps
Generally, both Vue.js and ReactJS 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.
className instead of
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.
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.
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:
1 2 3 4 5 6 7 8
React component structure:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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 has 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.
You may find interesting: How We Created a Multi-site Setup for a Vehicle Marketplace.
Redux and Vuex
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 entire subdirectory, beginning with root rights. To avoid unnecessary reruns of child components, you need to either use
PureComponent or implement
shouldComponentUpdate if possible. You may also need to use immutable data structures to make state changes more optimized.
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 the
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 reductors.
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.
To use the storage inside ReactJS components, we need to connect them using
connect() function via Redux. Deciding which components should be connected is one of the most topical issues in the entire React / Redux data stream. Fortunately, there’s a simple pattern that is extremely useful for building ReactJS applications. It suggests dividing components into two categories: Containers (Smart) and Stateless (Dumb) components.
Components connected to the storage are usually called Containers, and the Dumb components are usually a simple function that returns a markup.
You cannot use
connect() quite often as it is rather complicated (as in our practice). A typical example might be mapping over an array of IDs and returning the matching object references, such as:
1 2 3 4 5
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:
1 2 3 4 5 6 7 8
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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.
React vs Vue: comparison summary
As articulated earlier, React is to be chosen in case you need to build up a complex web application, such as an e-commerce platform, marketplace etc.
Future maintenance and customization are much easier through the community volume as you can behold a large number of contributors and developers ready to build any application as their amount is exponentially greater than Vue.
An added reason for ReactJS is a huge amount of libraries and tools available to simplify and accelerate the development process. There is no need to write a function from scratch while the ready-made solution is available.
Check our GitHub repository on React app best practices.
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 that allows mastering the framework in a short period of time and entering upon the application development.
Vue community is smaller than React but it is growing at warp speed that makes it possible to create the same solutions as using ReactJS. As the contribution volume grows, the number of tools and libraries available becomes larger, too.
Check our GitHub repository on Vue app best practices.
To sum up all pros and cons, let’s have a look at the Vue.js and React comparison table.
|React and Vue: Summary|
|Maturity||Developed by Facebook in 2013, 117.500 stars on GitHub.||Developed by Evan You in 2014, 122.000 stars on GitHub.|
|Community||116.000 questions on StackOverflow, 50.000 npm packages.||27.000 question on StackOverflow, 14.000 npm packages.|
|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-pary 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 use connect() function very often.||Despite awkward syntax and inconvenient transfer of props, the 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 such as the creation of web applications, single-page applications, and user interface components.
To conclude, let’s sum up all the information, pros and cons of the mentioned web development tools to see which one will be a better choice for your business.
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 as they can provide you with a great number of possibilities to feel comfortable within any task.
Whatever you choose - you cannot go wrong!
Check our case studies to see how we develop great online marketplaces with React and Vue.