State Management of API Web Service using Redux on React
Native App
Miftachudin, Muhammad Khoirul Hasin and Afif Zuhri Arfianto
Mechanical Engineering, Politeknik Perkapalan Negeri Surabaya, Surabaya, Indonesia
Keywords: Redux, React Native, State Management, API Web Service.
Abstract: There are two data types which control components in the React Native framework, props and state. React
Native uses state and it often raises problems in client-side applications. The state changes of the enterprise
application component leads to collisions between the states. To avoid these collisions, it is necessary to
have a management state. Whereas, Redux is the most widely used state management for Javascript based
applications, for instance; framework React Native. This study is to discuss comprehensive processes to
make React Native-Redux application. The first step is to discuss some ways to make component in React
Native. To obtain the data from API web service data sources, applying library third-party React Native is
taken. Data which is resulted from the source stored in Redux state. Then it will be discussed deeply how to
manage more than one state that is in a different component. The results of this study are in the form of an
Android application using the Redux management state. The application runs normally when tested using an
Android emulator from Android Studio. The data displayed matches the defined action type.
1 INTRODUCTION
There are two types which control the component at
React Native framework, props and state. Props is
set by immutable application. However, for data
which has mutable value, React Native uses state
(Facebook, 2019).
Mostly, state produces problems
for client-side application. The state changes at the
enterprise application component lead to collision
between states. To avoid the collision, it requires
state management. The most state management used
for Javascript- based application is Redux, for
instance, React Native framework (B. Alex, et al,
2017).
In Github, the definition of Redux is a
predictable state container (D. Abramov, 2019).
This means that any change in state can be easily
identified. Redux will first save the actions of states
in one container so that they are informed to other
states to adjust the order of the change reaction. For
more details, the role of Redux in an application,
namely:1) state changes will be made the time,
place, and sequence should 2) state changes are only
made by one person in charge (read: redux) 3) when
there is a change, all states will receive information
to adjust the reaction. 4) when there is an error in the
state, Redux can immediately fix it (D. Abramov,
2015). In this study the data source used is from the
web service API provided by Github. The format
uses a shared data format in the form of JSON
(JavaScript Object Notation).
There are several studies that have discussed
Redux, those are: Matthias Kevin Caspers who
explained the relationship of React (not React
Native) and Redux, he explained only the elements
used in Redux without any more comprehensive
explanation on how to apply it in React (M. K.
Casper, 2017). Wenhao Wu only explained the
principle of Redux and compared it with other state
management, namely Mobx (Wu, 2018). Mikael
Nordström created a bug report tool to diagnose the
state in the React Native third-party library (M.
Nordström, 2018). However, this study discusses
comprehensive some steps to create a Redux React
Native application. First is to discuss how to create
components in React Native. To retrieve data from a
web service API data source, the next step is to
implement a React Native third-party library. Data
generated from these sources, stored in a state where
the state is managed by Redux. Deeper, will be
discussed how to manage more than one state that is
in a different component.
Miftachudin, ., Khoirul Hasin, M. and Zuhri Arfianto, A.