title: Access the datas in redux-persist (react native)
body: <p>I am a newbie in react-redux. I am trying a Todo app using redux. Here I need to store the data and show them as soon as the app opens, for which redux-persist is used. And it works fine. The one where I am stuck is in action. I have initialized id = 0 here. Hence every time app opens, it stores the data from id = 0 and then increments. How can I refer to the last id stored from persist and use it when the new data is added?</p>
  
  <p>App.js</p>
  
  <pre><code>export const persistor = persistStore(store);
  
  class App extends Component&lt;Props&gt; {
    render() {
      return (
        &lt;Provider store={store}&gt;
          &lt;PersistGate loading={&lt;ActivityIndicator /&gt;} persistor={persistor}&gt;
            &lt;ToDoApp /&gt;
          &lt;/PersistGate&gt;
        &lt;/Provider&gt;
      );
    }
  }
  </code></pre>
  
  <p>store</p>
  
  <pre><code>const persistConfig = {
       key: 'root',
       storage,
       stateReconciler: autoMergeLevel2 
  };
  
  const pReducer = persistReducer(persistConfig, rootReducer);
  
  export default (store = createStore(pReducer));
  </code></pre>
  
  <p>action</p>
  
  <pre><code>import { ADD_TODO, TOGGLE_TODO } from './actionTypes';
  
  let nextId = 0; // how to initialize nextId as the last id from persisted data?
  export const addToDoo = text =&gt; ({
    type: ADD_TODO,
    id: nextId++,
    text
  });
  
  export const toggleTodo = id =&gt; ({
    type: TOGGLE_TODO,
    id
  });
  </code></pre>