On the Design of store when developing Multi-page applications with react+react router+redux

recently, I am learning the framework of react. I have only used a single-page application before, but now I want to use it to build a multi-page forum application. If I encounter some questions, I will ask my predecessors to answer them.

I now get the data from the server and initiate an action to change the store and re-render the page.

ask three main questions first:
1. Many pages have shared data information, such as the simple display of user information in the forum header. How should this information be put into store so that operations such as refreshing and redirecting pages will not reset store?
because the store is reset because the page is refreshed or a new page is opened, I designed the login page to store the data in store, and the page to jump (window.location.href jump) to the forum home page, and then found that store has been reset, which is equivalent to doing nothing.
should the shared data be saved in loaclstorage first, and then put into store after any operation that will cause the page refresh effect is completed?

2. Because I want to make it multi-page, I use a tag instead of Link tag in many places. Is that wrong?

3. In multi-page mode, is the store of different pages the same? How to design store? for multi-page applications


1, store data should be fetched from the back end and stored when the page is refreshed. The interface should be re-requested. When the forum header information is refreshed, the data is re-requested, the jump should be a route jump, and the head piece should be motionless.
2, the essence of Link is a tag, and has been expanded. But you replaced Link with a. This practice is not advocated.
3, no matter how many pages, single page. The whole application is only one storey! Store must be different from page to page. Some can be fixed by business, some by components, and some by routing.


1, reset when the page refreshes or opens a new page, including opening a new tab, store . Page jumps should use router . If you want the previous data to be refreshed, you can save it to sessionStorage .
2. If the url of the entry remains single, you can use both Link and a tags, because Link is eventually rendered as a .
3, the so-called multi-page mode means that the entry url is different, so it is called multi-page. Our approach is that an entry corresponds to a entry , that is, an application corresponds to a store .

Menu