How can i hold my datas in page when ı change active page in React.js?

Viewed 210

I'm using material ui tabs and i have 8 pages in tabs. Every page is a component. And when i changed active tab, I call another component .There are inputs area in my pages so when i changed tabs and return previes tab, my old datas clear. so ı want to hold my input datas when pass to another tab. how can ı hold my data?

2 Answers

I think the only way is to use redux. Save form data in redux and use them when you load the component to set initial data.

For the global client state, I can recommend Recoil, Redux, or MobX. For server state, I suggest you look at React-query or SWR.

Related