Written by Quadrum Lee
January 19, 2020
In this article, I list down frequently used NPM react packages for React / React-native Developers. The following react packages are efficient, secure and easy to use. But you should choose the libraries according to your project requirements (Size, Scalability, complexity, security, and reliability). So read the article carefully and pick the best react packages to speed up your app development.
02) Individual React Native Libraries (React-Native)
03) State management libraries (React/ React-Native)
(2) react-redux – This package is specifically built for React to manage the React application state. This helps to bind between React & redux that allows the component(Container component) to listen to store state changes
|Mobx vs Redux||Mobx||Redux|
|Datastore||MobX can have more than 1 data store.||Only 1 large store.|
|Capabilities||Used for simple and small applications||Used for complex and scalable applications.|
|Scalable||Scalability is less||Scalability is high and can be used in large scalable applications.|
|Performance||Good performance||Not much efficient compared to mobX|
04) Http clients (React/ React-Native)
There are a lot of ways to make HTTP requests and load resources from a remote URL. Browser built-in
fetch() function installed in the modern browsers and no need to install a third-party package to access it. It returns a promise. There are some other libraries that provide benefits over
fetch() function. Let discuss them as well.
(1) Axios – Promise based HTTP client and very similar in functionality with fetch(). But Axios work better for backward compatibility than fetch().
Benefits of Axios over fetch
(i) It has built-in XSRF protection.
XSRF stands for Cross-Site Forgery. So why do we need this protection? Let say, you log into your bank account on your computer and receives the session token. It makes sense right?. So After a while, you receive the disguised email from hacker and you click the link in the email. It will run some code on your computer and connect to your bank account with a previously logged session token.
Holy shit! All of your fetch APIs are going to be hacked but don’t worry, now website security has strengthened over the past few years. Anyway, It is better to stay on the safe side.
(ii) It performs automatic JSON data transformation.
Using fetch() – Need to transform.
Using axios() – Does automatic transformation.
(iii) Support a wide range of browsers.
Both fetch() and Axios() support Google Chrome, Opera, Safari and edge, but Axios supports IE8 and newer versions as well. It allows your web applications to compatible with a large range of browsers.
(iv) Axios has Interceptions.
You can run your code, change the request, or response data before the request is made or promise is settled (you can run async operations before .then() or catch() is executed).
(v) Monitor the progress of the POST Request.
Let say, you have a large request that would take a long time. So It doesn’t even trigger your promise .then() or .catch() methods and stay a long time in pending status. Fetch does not have to handle the above scenario, but Axios does. Check the sample post request using Axios
This is mainly designed to make HTTP calls in the simplest way and include high-level HTTP client features. By default, it follows redirect and supports HTTPS as well.
Lightweight client-side HTTP request library and rich of high-level HTTP client features. Promise based and lightweight progressive AJAX API works both node and all modern browsers.
Cool Gadgets on Amazon 2019 | Cool Amazon ProductsG, 0 Comments Today’s, topic about Cool Gadgets on Amazon 2019. Now, let's go and know about those gadgets in more deep. 01. The orange screwThis is one of the most clever and versatile tools you'll ever...
Is Interstellar Travel Impossible? | Interstellar TravelG, 0 Comments Today's, topic about Interstellar Travel Impossible. Let's go into deep and understand the scientific facts related to this topic. Simply, Is interstellar travel doomed to remain in the...
Smart Retail Technology in IoT – Smart Retail StoresG, 0 Comments Today's topic is about "How IOT Gives Rise to Smart Retail Technology". Simply, I want you to picture your kitchen at home. If you're like most people you can trace many of your...