Accessing the store [Question]
See original GitHub issueI was trying to access the store that is passed down to html.js from the server.js. First I tried the same approach wih the Connector and passing down the reducer in the connect. But the value for my reducer is always undefined. Is the dispatch part required ? from what I understand I can send connect like this:
const mapStateToProps = ({ tracker }: Reducer) => ({ tracker });
const connector: Connector<{}, Props> = connect(mapStateToProps);
export default connector(FlowHome);
Reducer
/* @flow */
import _ from 'lodash';
import {
TRACKER_NEXT_STEP,
} from './action';
import type { Tracker, Action } from '../../types';
type State = Tracker;
const initialState = {
currentStep: '0',
completedSteps: [],
};
export default (state: State = initialState, action: Action): State => {
switch (action.type) {
case TRACKER_NEXT_STEP:
return _.assign({}, state, { currentStep: action.currentStep });
default:
return state;
}
};
Type
export type Tracker = {
currentStep: string,
completedSteps: Array<string>,
}
export type Reducer = {
tracker: Tracker,
router: any,
};
export type Action = { type: 'TRACKER_NEXT_STEP', currentStep: string };
Any suggestion on what is the correct way to get the state this way. This reducer specifically is really simple and does not have any calls to the server. And the state holds a string.
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to access 'store' in react redux? (or how to chain actions)
I've found quote a few questions about it (How to access store in second component in react-redux) but they only talk about accessing...
Read more >Question: How to access Store from Effect? · Issue #467 - GitHub
I have feature module, with store created by using Store.forFeature and effect initialized by Effect.forFeature .
Read more >Frequently Asked Questions About Storage
All of our locations have convenient access hours that allow you to access your belongs on your time. Do you have storage options...
Read more >Solved QUESTION 1 ______ is a back entrance for store
Question : QUESTION 1 ______ is a back entrance for store owners to access, build and configure estore Store Front Admin Console ...
Read more >Frequently Asked Questions - Epic Games
The Support-A-Creator program enables content Creators to earn money from games in the Epic Games Store by using Creator Links and Creator Tags....
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 FreeTop 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
Top GitHub Comments
@wellyshen the problem was the import of the container in routes.js . I was importing the index directly. Thanks
@lgarro, Once I have the same question. There’s no a clearly answer, I’d like to recommend you to read the post.