question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Accessing global store actions from component store thunk

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ctrlplusbcommented, Mar 14, 2020

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.

👍

0reactions
JeromeDeLeoncommented, Sep 25, 2020

I totally forgot this one. 😂

Regardless, thanks for solution you provided. Totally appreciated!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found