state-as-querystring
Save your application state in query string between page views.
String, Number and Boolean and Array values will be saved as is, while object values will be encoded as JSON.
Usage
Idea is simple. When state in initiated, we read it from the query string. Whenever it changes, we write it to the query string. This keeps start between page views and allows sharing urls of a given state.
React example
; Component // read state from url when initializing the store { superprops; thisstate = ; } //save state to url when state is changed { ; } { return <textarea value=thisstatetext /> ; }
Redux example
; // read state from url when initializing the storeconst store = ; // save state to url when state changes store;
A bit more complex example - with arrays in the state + partial syncing of the state.