You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we don't have a solution for sync data fetching and normalization working together.
The key problem is, when we do a sync data fetching (by directly const data = readData()) in render function, we have to introduce an async useEffect to dispatch actions putting data into redux store, while useEffect is async, sync rendered children cannot reach fetched data.
Since react is going forward to 18 and suspense data fetching is about to land, this pattern can be more and more popular in the future.
What is the new or updated feature that you are suggesting?
Should be a new feature
Why should this feature be included?
Normalization is a good idea for robust applications but it is now working well with sync data fetching like Suspense, this can introduce risks when we want to move to newer architectures
What docs changes are needed to explain this?
I don't have any idea about how it can be solved, but this is a problem for current react-redux
The text was updated successfully, but these errors were encountered:
First, this repo is for React-Redux, which is the bindings layer between a Redux store and your React components. Any requests for features related to core Redux logic aren't relevant in this repo.
Second, we just released our brand new "RTK Query" API as part of Redux Toolkit 1.6, which is a purpose-built data fetching solution built for Redux usage. Please see the RTK Query docs for details on how to use it:
New Features
Currently we don't have a solution for sync data fetching and normalization working together.
The key problem is, when we do a sync data fetching (by directly
const data = readData()
) in render function, we have to introduce an asyncuseEffect
to dispatch actions putting data into redux store, whileuseEffect
is async, sync rendered children cannot reach fetched data.I've created a sandbox to demonstrate this issue: https://codesandbox.io/s/dazzling-worker-73nem?file=/src/App.tsx
Since react is going forward to 18 and suspense data fetching is about to land, this pattern can be more and more popular in the future.
What is the new or updated feature that you are suggesting?
Should be a new feature
Why should this feature be included?
Normalization is a good idea for robust applications but it is now working well with sync data fetching like
Suspense
, this can introduce risks when we want to move to newer architecturesWhat docs changes are needed to explain this?
I don't have any idea about how it can be solved, but this is a problem for current
react-redux
The text was updated successfully, but these errors were encountered: