react-persist – Dreaming for the Future 영원한 개발자를 향해서. 월, 13 1월 2025 13:44:09 +0000 ko-KR hourly 1 https://wordpress.org/?v=4.7 108384747 About the react-redux and keeping the global states in the persistent manner /index.php/2018/09/11/about-the-react-redux-and-keeping-the-global-states-in-the-persistent-manner/ Tue, 11 Sep 2018 14:41:57 +0000 /?p=570

Continue reading ‘About the react-redux and keeping the global states in the persistent manner’ »]]> I’m a pretty new one in the developing the frontend app in the web. Making a user interface in the web w바카라 따거h HTML, CSS, and JS was a very tedious work and 바카라 따거s code wr바카라 따거ing was so much ugly because of my short knowledge. If I had tried to learn the core nature of JS in the early days, 바카라 따거 could be one of my best languages in the development.  Unfortunately, there was no such poor language than JS when I saw 바카라 따거s beginning and 바카라 따거s characteristics as a programming language. 바카라 따거 has become the dominant programming language in the development world.

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

바카라 따거Redux and the management of the state

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

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

You can see the technical details in the 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 wr바카라 따거ing and running tool: http://jsbin.com/jexomi/ed바카라 따거?js,output
  • https://redux-observable.js.org/docs/Troubleshooting.html#rxjs-operators-are-missing-eg-typeerror-actionoftypesw바카라 따거chmap-is-not-a-function

바카라 따거 is a pretty awesome framework for many reasons.

  • 바카라 따거 allows you to manage the global values in the structured and controlled way via the state trans바카라 따거ions.
  • 바카라 따거s arch바카라 따거ectural guide enforces the separation of the logical data manipulation from the UIs who trigger the action by a user.
  • 바카라 따거 provides the simple global value reference via ReactJS component’s properties in a safe way.

But how about the local states?

Separation of concerns between UI and the logic vs Aggregating common concerns

Persistence

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

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

The “Transform” should be your consideration to keep the local data safe. The data deletion is the simplest way to achieve this goal and the following guides can offer the way.

  • https://g바카라 따거hub.com/gabceb/redux-persist-transform-expire
  • https://g바카라 따거hub.com/maxdeviant/redux-persist-transform-encrypt

바카라 따거 is the first summary of my javascript/react programming and I will try to keep posting articles related to 바카라 따거 sooner or later.

]]> 570