Demystifying React essentials
Table of contents
Many people argue that React is not a beginner friendly framework due to its complexity. Their criteria for judging is usually based on certain myths that freely roam around React ecosystem. In this short article, we will discuss and demystify five common myths that are associated with React. So let's start our short journey!
Myth one: React is a framework
Myth two: React can’t be used as a <script> tag
Well, it can, but it shouldn't. Theoretically, you can load React in the <script> tag, but it is not considered as a good practice unless you are just testing out a few things and exploring the library for the very first time. If you want to, you can do it by including React and React-DOM packages. Including React is an obvious step and including React-DOM means you want your React application to run inside the browser (hint: React can run on other platforms as well).
Myth three: React is hard to set up
This is a tough one. Setting everything up from scratch to a production level stage isn't the easiest task - especially if your application is a complex one. We have seen that including React as script tag isn't the best solution either. Luckily for you, there is a tool to help you get up and running with some pretty neat stuff - I am talking about create-react-app CLI. Official command line interface lets you create React applications with no build configuration. To create one, you only have to run this command from your terminal: create-react-app
Myth four: If you want JSX, you need Webpack
Myth five: Redux is mandatory for dealing with an application state
No, it is not. Should you use it? - It depends. Redux is a tool for managing application state. If you’re learning React, don’t mix Redux with your first application - learn to think the React way. According to Dan Abramov (creator of Redux), you should only add Redux when you feel that something is wrong with your application's state. In that way, you will clearly understand why it is better to have a single source of truth for your data instead of storing everything inside components’ state. Many people fall into the trap of adding Redux way too early to their application when it doesn't solve any problems and adds an extra layer of complexity. Don't be one of them.
Latest blog posts
Intent classification: understanding text with the powe...
In today’s world, with the expansion of data generated from various sources, analyzing it has become a critical challenge for businesses. Read more about how intent classification of textual data works and how it can lead t...
What Is Stable Diffusion and How Does It Work?
For the past few years, revolutionary models in the field of AI image generators have appeared. Stable diffusion is a text-to-image model of Deep Learning published in 2022. Find out the reasons why Stable diffusion gained ...