Redux
  • Read Me
  • 소개
    • 동기
    • Core Concepts
    • 3가지 원칙
    • 기존 기술들
    • Learning Resources
    • 생태계
    • 예시
  • 기초
    • 액션
    • 리듀서
    • 스토어
    • 데이터 흐름
    • React와 함께 사용하기
    • 예시: Todo List
  • 심화
    • 비동기 액션
    • 비동기 흐름
    • 미들웨어
    • React Router와 함께 사용하기
    • 예시: Reddit API
    • Next Steps
  • 레시피
    • Configuring Your Store
    • Redux로 마이그레이션
    • 객체 확산 연산자 사용하기
    • 보일러플레이트 줄이기
    • Server Rendering
    • Writing Tests
    • Computing Derived Data
    • Implementing Undo History
    • Isolating Subapps
    • 리듀서 구조화하기
      • 사전에 요구되는 개념들
      • 기본 리듀서 구조
      • 리듀서 로직 분리하기
      • 리듀서 예제 리팩토링하기
      • combineReducers 사용하기
      • combineReducers 더 알아보기
      • 상태 정규화하기
      • 정규화된 데이터 업데이트하기
      • 리듀서 로직 재사용하기
      • 불변 업데이트 패턴
      • 상태 초기화하기
    • Using Immutable.JS with Redux
  • FAQ
    • General
    • Reducers
    • Organizing State
    • Store Setup
    • Actions
    • Immutable Data
    • Code Structure
    • Performance
    • Design Decisions
    • React Redux
    • Miscellaneous
  • 문제해결
  • 용어사전
  • API 레퍼런스
    • createStore
    • Store
    • combineReducers
    • applyMiddleware
    • bindActionCreators
    • compose
  • 변경 기록
  • 후원자
  • 피드백
Powered by GitBook
On this page
  • Tips & Considerations For The Real World
  • UI vs State
  • Configure a Store
  • Naming Convention
  • Scalability
  1. 심화

Next Steps

Previous예시: Reddit APINext레시피

Last updated 6 years ago

If you landed in this section, you might be wondering at this point, "what should I do now?". Here is where we provide some essential tips/suggestions on how to diverge from creating trivial TodoMVC apps to a real world application.

Tips & Considerations For The Real World

Whenever we decide to create a new project, we tend to bypass several aspects that in the future may slow us down. In a real world project we have to consider several things before we start coding, such as: how to configure a store, store size, data structure, state model, middlewares, environment, async transactions, immutability, etc..

The above are some of the main considerations we have to think about beforehand. It's not an easy task, but there are some strategies for making it go smoothly.

UI vs State

One of the biggest challenges developers face when using Redux is to describe UI state with data. The majority of software programs out there are just data transformation, and having the clear understanding that UIs are simply data beautifully presented facilitates the process of building them.

Nicolas Hery describes it really well in "". Also, it's always good to know , because a lot of times

Configure a Store

To configure a store we have to make major considerations on which middleware to use. There are several libraries out there, but the most popular ones are:

Perform Asynchronous dispatch

    • Redux Thunk middleware allows you to write action creators that return a function instead of an action. The thunk can be used to delay the dispatch of an action, or to dispatch only if a certain condition is met. It incorporates the methods dispatch and getState as parameters.

    • redux-saga is a library that aims to make the execution of application side effects (e.g., asynchronous tasks like data fetching and impure procedures such as accessing the browser cache) manageable and efficient. It's simple to test, as it uses the ES6 feature called generators, making the flow as easy to read as synchronous code.

    • redux-observable is a middleware for redux that is inspired by redux-thunk. It allows developers to dispatch a function that returns an Observable, Promise or iterable of action(s). When the observable emits an action, or the promise resolves an action, or the iterable gives an action out, that action is then dispatched as usual.

Development Purposes / debug

    • Redux DevTools is a set of tools for your Redux development workflow.

    • redux-logger logs all actions that are being dispatched to the store.

To be able to choose one of these libraries we must take into account whether we are building a small or large application. Usability, code standards, and JavaScript knowledge may also be considered. All of them are similar.

Tip: Think of middlewares as skills you give to your store. i.e: By attributing the redux-thunk to your store, you're giving the store the ability to dispatch async actions.

Naming Convention

A big source of confusion when it comes to a large project is what to name things. This is often just as important as the code itself. Defining a naming convention for your actions at the very beginning of a project and sticking to that convention helps you to scale up as the scope of the project grows.

Scalability

There is no magic to analyze and predict how much your application is going to grow. But it's okay! Redux's simplistic foundation means it will adapt to many kinds of applications as they grow. Here are some resources on how to build up your application in a sensible manner:

Great source: and

Tip: Set up an opinionated code formatter, such as .

Tip: It's great to plan things beforehand, but don't get caught up in . Done is always better than perfect, after all. And if you need to.

With all that being said, the best practice is to keep coding and learning. Participate in and . Helping others is a great way of mastering Redux.

Tip: A repository with an extensive amount of content about best practices and Redux architecture is shared by @markerikson at .

Describing UI state with data
When to use Redux
You Might Not Need Redux
redux-thunk
redux-saga
redux-observable
redux-devtools
redux-logger
A Simple Naming Convention for Action Creators in Redux
Redux Patterns and Anti-Patterns
Prettier
Taming Large React Applications with Redux
Real-World React and Redux - part l
Real-World React and Redux - part ll
Redux: Architecting and scaling a new web app at the NY Times
"analysis paralysis"
Redux makes refactoring easy
issues
StackOverFlow questions
react-redux-links