Redux 툴킷이란 무엇입니까? 🔨
목차
Introduction
What's included inside Redux Toolkit?
RTK Query
What does RTK Query include?
Conclusion
소개
The Redux Toolkit package was developed to be the new standard way to write Redux code, handling three major concerns about Redux itself...
- "Configuring a Redux store is too complicated"
- "I have to add a lot of packages to get Redux to do anything useful"
- "Redux requires too much boilerplate code"
제거해야 할 한 가지 중요한 점은 Redux가 강력한 데이터 가져오기 및 캐싱 기능을 제공한다는 것입니다. 이렇게 하면 동일한 논리를 수행하는 함수를 직접 만들 필요가 없습니다.
Redux를 사용할 때 Redux Toolkit을 사용할 필요는 없지만 개발 속도를 높이면서 코드를 건조하고 유지 관리하기 쉽게 만들기 때문에 권장됩니다. 이 패키지는 모든 기술 수준에서 사용할 수 있으며 처음, 중간 또는 끝에 추가할 수 있습니다. 나중에 Redux 툴킷 패키지를 사용할 계획이라면 작업을 더 쉽게 하기 위해 react/redux 애플리케이션을 redux 툴킷 패키지로 시작하는 것이 좋습니다.
Redux Toolkit에는 무엇이 포함되어 있습니까?
Redux Toolkit includes the following APIs... These APIs were created to supply logic and avoid repetition.
createReducer()
createAction()
createSlice
createAsyncThunk
createEntityAdapter
createSelector
RTK 쿼리
The RTK Query is given as an optional addition to the Redux toolkit package. It was built to ease the work load for programmers, solving the use case of data fetching and caching. The RTK Query is a compact and powerful toolset used to define an API interface layer for your app.
The toolset is built on top of the Redux Toolkit, and uses Redux internally for its architecture. RTK query provides additional global store management capabilities. To further understand RTK query, it is recommended that you install the Redux DevTools browser extension. You can then examine and replay the behaviors of your requests and cache as they execute.
RTK Query is already included with Redux Toolkit package. You can simply add the code:
import { createApi } from '@reduxjs/toolkit/query'
/* React-specific entry point that automatically generates
hooks corresponding to the defined endpoints */
import { createApi } from '@reduxjs/toolkit/query/react'
RTK 쿼리에는 무엇이 포함되나요?
fetchBaseQuery()
ApiProvider
setupListeners()
Redux Toolkit 설명서에서 RTK query에 대한 자세한 정보를 찾을 수 있습니다. 하지만 RTK 쿼리에서 빼야 할 중요한 점은...
결론
Redux Toolkit comes with a lot of tools that save you lines of code, time, and headaches. But its purpose and benefits have raised controversy in the tech realm. For some user's, the package is very useful and fits all the points listed above. However, some find that it requires a lot of boilerplate code and just makes things more confusing. The only way to truly find out, is to use Redux Toolkit for yourself! There are many tutorials out there explaining how to create small or large applications utilizing the toolkit. It is unknown whether Redux Toolkit is just another fad of programming, or here to stay...but we might as use while it's hot!
Reference
이 문제에 관하여(Redux 툴킷이란 무엇입니까? 🔨), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/maxinejs/what-is-redux-toolkit-b94텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)