So I was able to successfully link up my store to my main App.js, but now I get this error about storing data. I tried to purge to see if that would do anything, and I got a similar error where it said it could not purge data stored store {}.
UPDATE:
The issue is relating to const storage and the redux-persist-sensitive-storage library. Still, don't know how to save the data with this library.
store.js:
const initialState = {};
const storage = createSensitiveStorage({
keychainService: "myKeychain",
sharedPreferencesName: "mySharedPrefs"
});
const config = {
key: "root",
storage,
};
const middleware = [thunk];
const reducer = persistCombineReducers(config, rootReducer);
export default () => {
let store = createStore(
reducer,
initialState,
compose(applyMiddleware(...middleware))
);
let persistor = persistStore(store);
return { store, persistor }
}
index.js- reducers
export default ({
profile: profileReducer,
auth: authReducer,
photoSlider,
trip: tripReducer,
moment: momentReducer
})
example of one of my reducers:
import {
SET_TRIP,
CREATE_TRIP
} from '../actions';
const initialState = {
trip: []
}
const tripReducer = (state = initialState, action) => {
switch(action.type) {
case SET_TRIP:
return {
...state,
trip: action.trip
};
case CREATE_TRIP:
return {
...state,
trip: action.payload
}
default:
return state;
}
}
export default tripReducer