There is a very convinient way to store some render-independent data in React Class by creating a field for it.
For example, if I making several forms, each appearing only at certain step and want to save its data after each step, in Class I will do this:
/*in class*/
data = [];
saveData = (field) => {
this.data.push(field);
};
But how can I do the same in functional component if there is no "this", and all scope variables re-creating on each render?