react: why static propTypes

I am looking the redux todomvc codes. What is the static keyword in static propTypes? Thanks UPDATE No idea why downvoted? Is this post too simple? Comments are welcomed. Thanks. I hope I can delete this post. Answer static was not part of the last generation of Javascript (“ES5”), which is why you won’t find … Read more

How to use Redux to refresh JWT token?

Our React Native Redux app uses JWT tokens for authentication. There are many actions that require such tokens and a lot of them are dispatched simultaneously e.g. when app loads. E.g. componentDidMount() { dispath(loadProfile()); dispatch(loadAssets()); … } Both loadProfile and loadAssets require JWT. We save the token in the state and AsyncStorage. My question is … Read more

React Warning: Cannot update a component from inside the function body of a different component

I am using Redux with Class Components in React. Having the below two states in Redux store. { spinner: false, refresh: false } In Parent Components, I have a dispatch function to change this states. class App extends React.Component { reloadHandler = () => { console.log(“[App] reloadComponent”); this.props.onShowSpinner(); this.props.onRefresh(); }; render() { return <Child reloadApp={this.reloadHandler} … Read more

Transition to another route on successful async redux action

I have a pretty simple set of react components: container that hooks into redux and handles the actions, store subscriptions, etc list which displays a list of my items new which is a form to add a new item to the list I have some react-router routes as follows: <Route name=’products’ path=’products’ handler={ProductsContainer}> <Route name=’productNew’ … Read more

Understanding compose functions in redux

I was trying to create a store in redux for which I am currently using following syntax:- const middlewares = [ thunk, logger ] const wlStore = createStore( rootReducer, initialState compose(applyMiddleware(…middlewares)) ) The above works fine for me and I can access the store, but I lately I bumped into another syntax:- const wlStore=applyMiddleware(thunk,logger)(createStore)(rootReducer) Both … Read more

return promise from store after redux thunk dispatch

I am trying to chain dispatches with redux thunk function simple_action(){ return {type: “SIMPLE_ACTION”} } export function async_action(){ return function(dispatch, getState){ return dispatch(simple_action).then(()=>{…}); } } How do I get the dispatch to return a promise from the store? MORE SPECIFICALLY: I am probably just not understanding something here, but in all the examples with redux-thunk, … Read more