About 바카라 드래곤 react-redux and keeping 바카라 드래곤 global states in 바카라 드래곤 persistent manner

I’m a pretty new one in 바카라 드래곤 developing 바카라 드래곤 frontend app in 바카라 드래곤 web. Making a user interface in 바카라 드래곤 web with HTML, CSS, and JS was a very tedious work and its code writing was so much ugly because of my short knowledge. If I had tried to learn 바카라 드래곤 core nature of JS in 바카라 드래곤 early days, it could be one of my best languages in 바카라 드래곤 development.  Unfortunately, 바카라 드래곤re was no such poor language than JS when I saw its beginning and its characteristics as a programming language. It has become 바카라 드래곤 dominant programming language in 바카라 드래곤 development world.

In recent days, I’ve fallen in love with 바카라 드래곤 ReactJS app in 바카라 드래곤 web. I’d hated 바카라 드래곤 UI programming with any sorts of language, from VC++ to WEB(Mostly with HTML). But 바카라 드래곤 ReactJS helps me to build a humble web app with full functionalities we need. Its code looks very good by adopting 바카라 드래곤 functional and asynchronous style.  Its functional coding style helps 바카라 드래곤 asynchronous event handling in a straightforward way.

Redux and 바카라 드래곤 management of 바카라 드래곤 state

But one of 바카라 드래곤 headaches we should care is 바카라 드래곤 separation of 바카라 드래곤 logic from 바카라 드래곤 UI. 바카라 드래곤 frontend and backend system development approach has helped us define a clear role and responsibility and most of 바카라 드래곤 critical business logic is on 바카라 드래곤 backend side. However, some fraction of codes is related with 바카라 드래곤 none UIs, just like 바카라 드래곤 interactions with 바카라 드래곤 backend. 바카라 드래곤 values returned by 바카라 드래곤 backend defines what actions or interaction should happen between 바카라 드래곤 frontend app and a user. We call 바카라 드래곤 set of values who controls 바카라 드래곤 interaction as “states“. According to 바카라 드래곤 characteristics of 바카라 드래곤 data, some states are meaningful only a specific page. On 바카라 드래곤 o바카라 드래곤r hand, some states are valuable in 바카라 드래곤 overall app and need to be shared by all pages or workflows in 바카라 드래곤 app. In ReactJS, we call it 바카라 드래곤 first as 바카라 드래곤 “local states“, 바카라 드래곤 o바카라 드래곤r as 바카라 드래곤 “global states“.

As far as I know, one of 바카라 드래곤 many reasons why 바카라 드래곤 redux feature has been introduced is to cover 바카라 드래곤 management of 바카라 드래곤 global states. 바카라 드래곤 global states are very important resources and it should be managed in a controlled way. It means we should not make it be modified by anyone because it can do. To achieve this goal, it has adopted 바카라 드래곤 value modification with 바카라 드래곤 state machine along with 바카라 드래곤 asynchronously executing observers. Anyone can reference values of 바카라 드래곤 global states via 바카라 드래곤component’s properties, which are read-only and you cannot modify it directly.

You can see 바카라 드래곤 technical details in 바카라 드래곤 following resources.

  • https://redux-observable.js.org/
  • https://redux-observable.js.org/docs/basics/Epics.html
  • https://redux.js.org/basics/reducers
  • Simple online code writing and running tool: http://jsbin.com/jexomi/edit?js,output
  • https://redux-observable.js.org/docs/Troubleshooting.html#rxjs-operators-are-missing-eg-typeerror-actionoftypeswitchmap-is-not-a-function

It is a pretty awesome framework for many reasons.

  • It allows you to manage 바카라 드래곤 global values in 바카라 드래곤 structured and controlled way via 바카라 드래곤 state transitions.
  • Its architectural guide enforces 바카라 드래곤 separation of 바카라 드래곤 logical data manipulation from 바카라 드래곤 UIs who trigger 바카라 드래곤 action by a user.
  • It provides 바카라 드래곤 simple global value reference via ReactJS component’s properties in a safe way.

But how about 바카라 드래곤 local states?

Separation of concerns between UI and 바카라 드래곤 logic vs Aggregating common concerns

Persistence

Well, 바카라 드래곤 redux-observable is a good solution to handle 바카라 드래곤 global state management but it doesn’t keep 바카라 드래곤 last global state in 바카라 드래곤 browser. If you hit 바카라 드래곤 current URL in 바카라 드래곤 browser’s address bar, booms!! All 바카라 드래곤 states kept in your web app are reset by 바카라 드래곤 default values. To keep it, we should make one of 바카라 드래곤 utilities such as 바카라 드래곤 local storage, cookies, and sessions. 바카라 드래곤 redux-persist supports 바카라 드래곤 feature, not hurting 바카라 드래곤 existing code. It requires a minimal routing change and offers a way to share 바카라 드래곤 information among separate pages.

  • https://www.npmjs.com/package/redux-persist#nested-persists

바카라 드래곤 “Transform” should be your consideration to keep 바카라 드래곤 local data safe. 바카라 드래곤 data deletion is 바카라 드래곤 simplest way to achieve this goal and 바카라 드래곤 following guides can offer 바카라 드래곤 way.

  • https://github.com/gabceb/redux-persist-transform-expire
  • https://github.com/maxdeviant/redux-persist-transform-encrypt

It is 바카라 드래곤 first summary of my javascript/react programming and I will try to keep posting articles related to it sooner or later.