Async store.getState().intl.locale
See original GitHub issueI am using react starter kit with redux and intl.
export default {
path: '/article',
children: [
{
path: '*',
async action({ path, store }) {
const language = store.getState().intl.locale;
await store.dispatch(loadPageData( language,path));
const data = store.getState().pagedata;
return {
title: data.title,
component: <Layout><Content content={data} /></Layout>,
};
},
}
]
};
The problem is that when i change language using
onClick={async (e) => {
e.preventDefault();
await setLocale({ locale });
}}
first get called SET_LOCALE_START action, then const language = store.getState().intl.locale; then SET_LOCALE_SUCCESS and the result i am using language from previeus state. Any help, suggestion?
Issue Analytics
- State:
- Created 7 years ago
- Comments:15
Top Results From Across the Web
redux store out of sync store().getState() with state from redux ...
Problem starting when I whant to get current store by store().getState in my App.js. createStore.js const configureStore = preloadedState ...
Read more >Understanding Asynchronous Redux Actions with Redux Thunk
Learn how to use the Redux Thunk middleware to run asynchronous operations, talk to an API and dispatch actions to the store.
Read more >Store - Redux
Store. A store holds the whole state tree of your application. The only way to change the state inside it is to dispatch...
Read more >createAsyncThunk in Redux-Toolkit | by Abhimanyu Chauhan
createAsyncThunk · dispatch: dispatching different actions. · getState: to access the redux store from within the callback · requestId: this is a unique...
Read more >Building an Awesome Magazine App with i18n in React
It makes sure that our <html> element is synced correctly with our current locale. setLocale also lets our UI i18n library know what...
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
Thanks @langpavel i will make more research and for now i will your 2nd suggested option.
@Shadowman4205 Sorry, I cannot guide you to subdomain. It is out of scope and as I said you will have much more configuration with this, not only in RSK but with server configuration as well:
In practice, almost no one using domain prefix because of this. If you think about wikipedia for example, you will see that it is collection of different deployments of same engine with completely different setups.
More common way is to use URL prefix