DEV Community

loading...
Cover image for React should become a framework already

React should become a framework already

Michael De Abreu
I’m a developer that do web applications by day, and games by night. I work with Typescript every day, using tools like Angular and React. In this post I like to write about my experiences with those.
・4 min read

Photo by Abbilyn Zavgorodniaia on Unsplash

If you'd follow me, you should know that I'm an Angular advocate. Still, that doesn't mean that I don't work with tools other than Angular. In fact, I have been working the last year with React. Previous to this project, I worked for over 6 months about three years ago with React as well. So, I might no be considerer an "expert" in React, but I think I do have enough experience to know what I'm going to write about.

Landscape Review

React was released 7 years ago, with one job, and one job only: To deliver the best UX performance-wise possible. That's why React is a library to manage the UI. Nobody doubts that React did a really good job managing the UI in comparison with the primary competitor it had back then: AngularJS.

Because of the same reason, many of the features that AngularJS has were left out. Some of them could be considered unnecessary by most developers, like built-in services, or directives. Those could be easily replaceable with singletons, and HOC. But, some features like routing, global state, or forms, were so needed that the community quickly got some libraries to fulfill those tasks.

Since the first version of React, we had seen many frontend tools being released and most of them describe themselves as "frameworks", like Angular, Vue, even Next.JS. And why is that? Because they include everything you need to start your development without looking at external libraries. Sure, you could and probably will anyway, but the libraries that you actually require to start the development are little to none. They often offer you everything you need, routing, global state, and forms.

React needs to evolve

Some developers use React to write SPA, but some others don't, some developers use React to write just the view in a server-rendered application, or to write mobile apps with React Native, or desktop apps with Proton or something similar. All of those uses cases should be covered.

The state management has seen a huge improvement with the introduction of hooks. You can now easily develop an application that doesn't require the usage of Redux for state management, you can use use the new Context API to manage global state, and the useContext hook to access that state.

React needs a routing solution out of the box. React Router has been the de facto router to React and having one library is a good thing. But, because you have other solutions that you could choose, if I want to build something around the routing, for example, a library to manage routed modal, I can't assume you will use React Router. It would be different if React had a library to manage the routing. Because I would know that you'll probably use that.

React also needs form management. If with routing we have a de facto solution, with forms we have so many options, that I've seen peers in other projects literally doing their own way to manage the state of the form. If I require an Angular developer for a project, I would expect they use Angular Forms. But, with React, I can't have the same expectation, because we have tens of libraries that do the same. But, if React had some library or features, that improves the form management, its usage would be expected.

What would that mean to the current React ecosystem?

In my opinion, improvement, and consistency. Right now, there are just too many steps involved in creating a React Stack framework to work with. You need all those other tools, even for the simplest SPA, you need routing, state, and forms management.

This would also mean a better developer experience. Right now, if you have a React Stack in one project, and you go to another one, you will probably have to learn everything again. That wouldn't happen if React has all the tools you need. Your knowledge would be consistent across projects.

And, of course, better integration with React itself. Because the React teams know the inners and outers of React, and they can take advantage of it. How easy could be for them to develop a two-way data binding or hooks that improves forms management*?

That's all folks

I hope you enjoy this, and I'm really looking forward to sharing some comments with you. Take care, and take care of your loved ones. Bye-bye!

  • I'm sorry if it seems like I'm really pushing the forms thing trough, but if you had managed forms with Angular, you know already how easy it is to manage them, and is something that comes with the framework. Vue also has a great two-way data binding feature that allows you to model the data as you want. With React, you have to deal with synthetic events and other things that make it "no so good", in my opinion.

Discussion (10)

Collapse
nomoredeps profile image
NoMoreDeps

This is a very interesting point.
I'm a big fan of C# and the .net framework in general. However, I avoid using Angular on the client side whereas structurally it brings as much, i.e. a complete framework.

On the other hand I use React intensively, but not necessarily with react-router, not with Redux but Shadow-flux, in short with what I need when I need it.

I think that what I like so much about React and its ecosystem is that it is not a Framework, and I don't think it's an interesting evolution. It's this philosophy of not constraining this library to a framework that makes it so popular.

For me it's the nature of the same freedom not to be a framework that's its biggest strength.

Collapse
keonik profile image
John Fay

I’m definitely on the side of enjoying the choice of libraries to use but I definitely hear and see your view from some coworkers. If you haven’t tried next or gatsby you may like those as they package in things like page routing.

Collapse
nomoredeps profile image
NoMoreDeps

I do agree, I prefer the use of frameworks that include it rather than seeing it becoming one 😉

Collapse
seanmclem profile image
Seanmclem

I feel like Gatsby, Next JS, Blitz.js, etc get the job done

Collapse
stereoplegic profile image
Mike Bybee • Edited

etc., etc., etc., etc., etc., etc.

You have plenty of framework options with React. The beauty of React is that you don't have to be married to a framework. Or do. Whatever. You do you.

Collapse
abdulghani profile image
Abdul Ghani

no. the best thing about it is that it's unopinionated. no need to deal with anyone's opinions. whereas if it's a framework it would shove you how you should be doing things. and wouldn't work if you make it otherwise.

Collapse
sami_hd profile image
Sami

But isn't that the beauty of react? To be be able to customize your experience?

Collapse
ije profile image
X.

or Aleph.js in Deno.

Collapse
loftwah profile image
Dean W Lofts

It's nice to read something from the pro Angular side of things.

Collapse
shriji profile image
Shriji

Have you tried Svelte?