I'm actually new to React, and can't choose, what is the best way to store data in a situation like this:
I have a form with some inputs, and I need to do some actions with all data from these inputs on submit.
All inputs are stored in one Component.
So, I need to get all the data only on submit. And now I'm trying to choose the best way to store this data. I see 2 ways:
Storing data in the state. But as React Docs describes:
Only data which need to render may store in the state.
But I don't need this data for render, I need to work with this only on submit.
Storing as class variables. It looks good for me, because when i
using state, i need to call setState(), which trigger render(which i
don't need), or this.state.data = ....But React Docs says that:
You may change state directly only in constructor.
So, which of these ways are better and why?