• Graphics
  • Figma
  • Research
  • Newsletter
  • About
  • Contact

Zhenia Vasiliev

  • Graphics
  • Figma
  • Research
  • Newsletter
  • About
  • Contact

All you need to survive your next React project

The key feature of React is composition of components. Components written by different people “should” work well together

It’s a bit annoying with searching the internet - every time you look for a framework or a library which is a little bit trendy, Google simply brings up posts by its advocates. They will tell you a lot of nice things about it. The same problem with React, a popular Javascript library - you will hardly learn what’s the problem with it, even if you enter “when not to use React” into the search engine. Yet, it’s simple, and written plainly in reactjs.org Design Principles: ”The key feature of React is composition of components. Components written by different people should work well together”.  “Should”, right?

React is beautiful for writing applications, and is the second most popular framework in 2020. But here’s the catch - its components are by definition opaque and can present you with various pains when re-using them in different contexts. To understand why, this piece unpacks what component-based design is, and wouldn’t we be better off using good ol’multi-paradigm Javascript instead.

But first of all, what is React?

ReactJS, or simply React, is a JavaScript library that provides a set of methods for better handling of front-end behaviours. It was created by Facebook’s software engineer Jordan Walke in 2013 as a way of building a dynamic UI with high performance, which was achieved by mixing the client and server-side processing of data. This essentially allowed the web pages to quickly respond to user’s clicks on likes and chat messages, as in client-side processing, and simultaneously be SEO-friendly, as in server-side applications. This principle of mixed behaviours is called isomorphism - and here’s a good explanation of it. So far so good - React performs faster, it’s easy to learn for anyone who knows Javascript, and hides all the complex internal code behind its layer of abstraction, leaving you only with fun stuff. But, crucially, it’s also component-based, meaning that it ideally designed in a way that its bit and pieces could be re-used.

RELATED
How to become a software developer for free in 2020
August 4, 2020
How to become a software developer for free in 2020
August 4, 2020

The problem that many people encounter when they decide to switch to software development is that they unknowingly make things harder for themselves. They jump into too many frameworks or learn programming languages without any particular system, going into the dense stuff way too early. In this piece you’ll find how to approach the new discipline without getting completely demoralised.

Read more →
August 4, 2020

Object- vs Component-based systems

Javascript at the core of React is a multi-paradigm language, meaning that it allows for both functional and object-oriented styles of programming. Leaving the explanation of the difference between these two styles to the brilliant piece by Shaistha Fathima, what is important here is that React itself uses a component-based model, which is, in essence, an extension of object-oriented one.

How are objects different from components?  Both come from the same core programming principle of evil duplication: do not duplicate knowledge throughout your systems (Thomas and Hunt, 2019:73). Based on this, software development has been steadily moving towards modularisation and had initially arrived, in the 1980s and 1990s, to the paradigm of object-oriented programming. Here the code would be build based on objects, their attributes that define their behaviour and methods that explain how objects relate to one another (SWEBOK, 2-10). The strategic advantages of building the code this way would ideally speed it up and make it easier to maintain because it will be better at interoperability (data exchange), will reuse the same object, meaning that it will scale easily, and be more reliable, as it will take less effort to test (González and Torres, 2005). With time the object-oriented model has evolved into a component-based, where components became more independent entities that could be developed and maintained separately. The idea was that the main application will use the component’s interface, using it similar to the object. The advantages over objects would be, for example, ability to call them from any language, and overall better quality.

“React is wonderful for writing applications, but horrible for writing libraries”
— Nick Gard, Webflow

The problem with components

Here’s where the paradox is - the system would work faster when it relies on the opaque components that encapsulate states and behaviours. But simultaneously, the system becomes harder to use, because the time and resources saved on writing the code are now spent on the activities that help make component model happen - we need to have more strict design and documentation, and a system of standards that allows to plug those components in. Remember all those phone chargers and cables you bought over the past ten years, now gathering dust in that murky place behind all the cardboard boxes? Components bear the same risks of becoming incompatible with new architectures. As Webflow’s Nick Gard observes, React components come with assumptions on how the application works and looks. And since, as we saw from the component-based strategy, they hide away all the markup, style, copy and behaviour, the components should be mostly worthless when trying to reuse them in the shape of a library.

Hooks as crutches?

Quite tellingly, the hooks that were introduced from React 16.8 back in 2018 are aimed at addressing these same problems. First, the ability of components to re-use the stateful logic. That’s the type of logic that is based on the states, which, in turn, are the values that describe the current condition of the component (Stackoverflow). Second, complex components become hard to understand. But now, what is “complex”? Something that you wrote two months ago, and now cannot recall what’s in there anymore? Or just something that has more than three lines of code? Then, safe to assume, it’s anything. Would that mean then that hooks were introduced as a cover-up for a larger strategic flaw, which is so vast it’s even bigger than React itself? Perhaps, this indicates a problem with the component-based design as a whole which was haunting it all along.

“Remember all those phone chargers and cables you bought over the past ten years, now gathering dust in that murky place behind all the cardboard boxes? Components bear the same risks of becoming incompatible with new architectures”

Conclusion

Admittedly, many other features that React shines at, such as virtual DOM and isomorphism we saw in the beginning, but these are the themes for a whole new blog post. And, after all, React is still indispensable for writing applications. All you need to survive your next React project is to be sure to write your own components and never plan to re-use them! But would the risks of component-based design finally sink it, together with other libraries that use this paradigm? Leave your comment, tweet the post or share to your favourite Facebook group to continue the conversation.


References

Bourque, Pierre, ed. 2014. SWEBOK (Software Engineering Body of Knowledge) Guide. IEEE Computer Society.
Brereton, P., and D. Budgen. 2000. “Component-Based Systems: A Classification of Issues.” Computer 33(11): 54–62.
González, Rafael, and Miguel Torres. 2005. “Critical Issues in Component-Based Development.”.
Thomas, David, and Andrew Hunt. 2019. The Pragmatic Programmer, 20th Anniversary Edition: Journey to Mastery. Second edition. Boston: Addison-Wesley.
Vitharana, Padmal. 2003. “Risks and Challenges of Component-Based Software Development.” Communications of the ACM 46(8): 67–72.

READ MORE
When Women Were Software
September 28, 2020
software development, history
When Women Were Software
September 28, 2020
software development, history

A documentary titled The Computers: The Remarkable Story of the ENIAC Programmers, tells a story women who developed America’s first electronic computer to automate ballistic computations during World War II. In the film, the six programmers share their stories about their hard work alongside over two hundred other women, both civilian and military, who were doing the computations before the machine came to replace them. Why, despite the massive contribution, the programmers were not introduced to the public when ENIAC was released to the public in 1946? This week, I look at the historical paradox where women were celebrated during the war as breaking into the ”male” territories of science, technology and engineering, yet at the same time, no-one heard much about their contribution in the early days of computer science. Like to help this blog going? Tell your friends about it, like and share the post. Check out the full blog post here: https://bit.ly/XXXX

Read more →
September 28, 2020
software development, history
How to escape the interview horror: talking good old expertise and teamwork
September 13, 2020
software development, today
How to escape the interview horror: talking good old expertise and teamwork
September 13, 2020
software development, today

It is as hard for the employer to find a developer, as it is for a developer to find a job. Yet, don’t worry about any other candidates they might be looking at, since most of them wouldn’t be able to program for their life. If you can successfully write a loop that goes from 1 to 10 in every language on your resume, can do simple arithmetic without a calculator, and can use recursion to solve a real problem, you're already ahead of the pack. This week, we talk about more curious things: the minds of people who interview you. What are they looking for, and how do they make sure what they find in you and other candidates is what they need? It comes down to two things - checking that you’re smart and get things done. That’s why any interview conversation usually breaks down into two themes - technical skill and teamwork. Like to help this blog going? Tell your friends about it, like and share the post. Check out the full blog post here:

Read more →
September 13, 2020
software development, today
Will Open Source Actually Beat Silicon Valley Start-Ups?
September 6, 2020
software development, community
Will Open Source Actually Beat Silicon Valley Start-Ups?
September 6, 2020
software development, community

Essentially, there are two ways of producing software. One is the ”Silicon Valley” way, where you start up as an entrepreneur in your garage, reach out to venture capitalists (VCs) who then invest into your idea, and later scale, if you’re successful - like Facebook. The second is a community way, where numerous members inspect, modify and enhance the applications that have openly available code bases. They gradually improve and add on features as the project goes along, like Linux.

Read more →
September 6, 2020
software development, community
How to get your first software developer job
August 29, 2020
software development, today, tools
How to get your first software developer job
August 29, 2020
software development, today, tools

You need to find a job to get software development experience, and you need the experience to find a job. A Catch 22? Well, not exactly. For one thing, development as a profession changes so much overtime that anyone who works here ends up learning, unlearning and re-learning things. And for another, coding culture differs from company to company, and it is going to take months for anyone, regardless of their experience to start knocking out valuable, production-ready code. This is why your chances of getting a job are not as bad as you might think. All you need to show them is that you have an open mind and easy to work with. As for specific skills, these will skyrocket once you’re positioned in a company where you’d be spending 8 hours a day coding, surrounded by experienced colleagues.

Read more →
August 29, 2020
software development, today, tools
Why you hate software engineer unions for all the wrong reasons
August 23, 2020
software development, community
Why you hate software engineer unions for all the wrong reasons
August 23, 2020
software development, community

Software development field looks like a level playing field for those who are starting out. There are many new exciting things to learn. Employers are readily lining up in front of your door with bright job offers. But one thing we learn soon is that the industry is regulated by the big business players. They are, alas, catering for their own needs rather than the worries of software engineers who do the work. This calls for a new set of regulations between programmers and those who hire them. You don’t have to call it a “union” if you hate associating yourself with the industrial workers, crowded outside of the factory walls. Today I look at why anyone can win from these regulations, including you. Ideas, thoughts or objections? Do you already have a tech union membership experiences? I’d like to hear your opinions - post a comment here, and please like and share this to keep the blog going.

Read more →
August 23, 2020
software development, community
Top free task management apps software developers love to hate
August 16, 2020
software development, tools
Top free task management apps software developers love to hate
August 16, 2020
software development, tools

Working as software developers, we are torn between so many different options for productivity tools. Some of them come as a default option from work (that we hate), some we love to use for personal stuff. But the problem with using many different tools is that it’s too hard to keep track of so many things in so many different places. So the easy answer is, choose one (!) tool and stick to it. But which one to choose then? Here I look at four tools which are hot this year.

Read more →
August 16, 2020
software development, tools

Never miss a post

Sign up with your email address to receive news and updates.

We respect your privacy.

Thank you!
 
tags: digital illustration, javascript, react, stackoverflow, learnprogramming
categories: software development
Thursday 08.13.20
Posted by Zhenia
Newer / Older

Zhenia Vasiliev © 2025