[Question] Accessing global store actions from component store thunk
See original GitHub issueI have this scenario where I have SignInStore that when successfully logged in, I need to save the current user globally in the context and what I currently did was created two exact copy of setCurrentUser in the component and global stores and used useEffect to handle communication between the two. Is there a way to access it directly from the component store?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Redux state access from actions, should i make store global?
On the change of userID, I want to fetch userData, I found a library for called redux-thunk, which can make dispatch-es async (I...
Read more >Redux Fundamentals, Part 4: Store
The Redux store brings together the state, actions, and reducers that make up your app. The store has several responsibilities:.
Read more >save Store as global variable ? · Issue #776 · reduxjs/redux
We create Store in app root and save it via function in another module. ... focused on React components) instead of we can...
Read more >How to load data in React with redux-thunk, redux-saga, ...
1. Install thunk · 2. Add thunk middleware when configuring store (configureStore.js) · 3. Create actions (redux-thunk/actions.js) · 4. Create ...
Read more >NgRx — Local Component Store | by Emre Hızlı
I will try to explain how to use the ngrx global store as a local component store. We will try to find some...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @JeromeDeLeon
Yeah at the moment this is a restriction in terms of the API of the context/component stores. I have been doing some thinking and may introduce simplified APIs of them for v4 that would also essentially provide a mechanism by which you could solve the problem you are describing.
I’ll post here when I get a PR together and would appreciate your feedback.
👍
I totally forgot this one. 😂
Regardless, thanks for solution you provided. Totally appreciated!