Redux thunk unmet dependancy with react 16.3.0-alpha.1

after updating to the newest version of expo (SDK 26) and updating react to ‘16.3.0-alpha.1’ I get the error below when installing redux-thunk, Any ideas of how to fix it or redux nom’s that will work and allow me to return action promises

├── UNMET PEER DEPENDENCY react@16.3.0-alpha.1
└── redux-thunk@2.2.0 

npm WARN @babel/plugin-check-constants@7.0.0-beta.38 requires a peer of @babel/core@7.0.0-beta.38 but none was installed.
npm WARN react-native-branch@2.0.0-beta.3 requires a peer of react@>=15.4.0 but none was installed.
npm WARN react-native-gesture-handler@1.0.0-alpha.41 requires a peer of react@> 15.0.0 but none was installed.
npm WARN react-native-maps@0.20.1 requires a peer of react@^16.0 but none was installed.
npm WARN react-redux@5.0.7 requires a peer of react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0 but none was installed.
npm WARN react-test-renderer@16.3.1 requires a peer of react@^16.0.0 but none was installed.

I think this might be related to something else. redux-thunk is pretty popular and I’m not seeing anyone having similar issues. Could you possible put together a snack that replicates the error?

1 Like

I am trying to return a promise from an action and the error I get is “Actions must be plain objects custom middleware for async actions”

this is the code for the action and the store

export const getCheckInLog = () => {
  dispatch => {
    SecureStore.getItemAsync('id').then(id => {
      const payload = { key: 'zev', uid: id };
      const url = 'http://www.repticity.com/beta/api/v1/mobile/checkins/';
      return axios.post(url, qs.stringify(payload)).then(response => {
        return Promise.all([
          dispatch({ type: CHECKIN_LOG, data: response.data }),
          dispatch({ type: IS_LOADING, data: { loading: false } }),
        ]);
      });
    });
  };
};

import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import promiseMiddleware from 'redux-promise';
import reducers from './reducers/index';

export default createStore(reducers, applyMiddleware(thunk, promiseMiddleware));

1 Like

I trust you aren’t making any obvious mistakes, maybe open an issue for redux-thunk with your findings.
Personally I use rematch which I think is way better. It has async built in through it’s effects. Here is an example: Rematch Example - Snack
Granted this won’t help for anyone with existing redux-thunk code :weary:
Sorry I couldn’t be more help :confused:

I can’t Promise( pun intended could resist :wink:) I’m not making any obvious mistakes , what do you suggest I look at just to double check, the code works fine when I return the dispatch as an object its only when I try returning the promise that it the error.

Honestly I couldn’t say for sure. Thunk is kinda old I’ve forgotten how to use it since things like async and await came along :confused:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.