React and Vue re-visited

After re-creating my portfolio with Gatsby (which uses React) and building an app for a client in Vue I feel I have more knowledge about the two JavaScript frameworks to give an informed opinion on both.

When I was first starting out using these sort of frameworks I wrote this article on my thoughts.

I would argue that React is quite an old framework. This leads to some benefits. There are a lot of tutorials online and a lot of examples and plugins that you can download to extend React. I may not have grasped the framework fully but I feel that because it’s an older framework, and it grew in popularity so quickly, it has become bloated and more difficult to understand. React has so many core features now, compared to when it first launched, such as hooks and state, with many more features planned. There are at least 2 different ways of doing things, such as the simple task of creating a component. You can either create a functional component or a class component. This means many tutorials are incompatible with each other, even when all of React is written in the same language, JavaScript. When initially starting out I didn’t like how you had to buy into the whole React eco-system. It was much like deciding to buy a MacBook. Coming from building static sites and having the option to use some PHP to make them dynamic, using React felt like I jumped straight into the deep end and had to use JavaScript for everything. There are even plugins that extend React enabling you to write CSS in JavaScript. I love CSS!

Vue was one of the first JavaScript frameworks I used. I started out by forking my lecturers class notes which used VuePress. I had no idea what I was doing but I managed to follow his tutorial and get up and running. I then used Vue to redo my portfolio on my photography site. This was more to complete a task and I was implementing it on a pre-built website, which uses PHP, and jQuery, it wasn’t an experience of building a SPA or a site from scratch. This experience came when building an app for a client. Building it with Vue was like a breath of fresh air. Vue template files split CSS, HTML, and JavaScript, just like a static site. The HTML doesn’t have to be JSX, but it can be. I use the V-If statement so much to conditionally render HTML. The Vue data attribute is a god save for managing variables and data within the application. Vue devtools make it really easy to manage too, it’s like a mini database on the Front-End. I understand how the Vue lifecycle works and know when to execute my code. No more worrying about whether I can call componentDidMount() on a functional component.

In conclusion, both frameworks have their merits but I’ll be using Vue from now on.