easy-peasy icon indicating copy to clipboard operation
easy-peasy copied to clipboard

Cannot read property 'persist' of undefined

Open krunaldodiya opened this issue 5 years ago • 6 comments

React Native cause error when using "useStoreRehydrated"

import React, {memo} from 'react';
import {Text, View} from 'react-native';
import {useStoreRehydrated} from 'easy-peasy';

function App() {
  const rehydrated= useStoreRehydrated();

if (!rehydrated) {
   return null;
}

  return (
    <View style={{flex: 1, backgroundColor: 'white'}}>
      <Text>hello</Text>
    </View>
  );
}

export default App;

Stack Trace in RNDebugger

D:\Code\Sarthi\com.sarthiacademy.org\node_modules\react-native\Libraries\Core\ExceptionsManager.js:179 TypeError: Cannot read property 'persist' of undefined

This error is located at:
    in App (at renderApplication.js:45)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:106)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:132)
    in AppContainer (at renderApplication.js:39)

D:\Code\Sarthi\com.sarthiacademy.org\node_modules\react-native\Libraries\Core\ExceptionsManager.js:179 TypeError: Cannot read property 'persist' of undefined

This error is located at:
    in App (at renderApplication.js:45)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:106)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:132)
    in AppContainer (at renderApplication.js:39)

krunaldodiya avatar Aug 17 '20 03:08 krunaldodiya

Hmm, is the StoreProvider for sure wrapping the application?

ctrlplusb avatar Sep 04 '20 08:09 ctrlplusb

Hmm, is the StoreProvider for sure wrapping the application?

Yes, I did it very well

krunaldodiya avatar Sep 05 '20 05:09 krunaldodiya

@krunaldodiya was this running via the Expo CL, and RN Web?

ctrlplusb avatar Oct 08 '20 09:10 ctrlplusb

@krunaldodiya was this running via the Expo CL, and RN Web?

no, there is the same issue

krunaldodiya avatar Oct 10 '20 10:10 krunaldodiya

any update on this?

pranoppal avatar May 25 '21 06:05 pranoppal

Any update on this ? Still have the same issue

Madfish5415 avatar Aug 09 '22 11:08 Madfish5415

Anyone manage to solve this? RN 0.70, easy-peasy 5.0.4

djvistasa avatar Oct 24 '22 13:10 djvistasa

I do not have any RN experience, so I'm unable suggest any resolutions for this. @ctrlplusb got any input here?

Maybe this is related to #599? And maybe this is a workaround?

jmyrland avatar Oct 24 '22 14:10 jmyrland

This was fixed in #836

jmyrland avatar Jul 27 '23 07:07 jmyrland