state data is undefined when modal closed

Solution 1:

Yes, state does not get persisted automatically. If you refresh the application or undertake an action that causes the browser to refresh (like clicking on a button), you lose state data by default.

In order to persist state, you would have to make use of local storage. You could reference my answer in this post to see how to use local storage. There is also a package called redux-persist that does a pretty good job of persisting Redux state after refresh. You can reference that package here.