W
W
Wood Walker2019-03-09 18:15:57
React
Wood Walker, 2019-03-09 18:15:57

Authorization form, correct implementation?

I have an authorization form, or rather a modal window. There is no backend to it (don't ask why), that is, I check on the front whether to give access or not. For this check, I need to find out what the user entered into the inputs. I see 2 options.

  • The simplest, and it seems to me the most incorrect, is to pull these inputs from the DOM value through the document.
  • The second option is to use refs, but then you have to create this ref, then pass it to the form component through props, and write it to the ref attribute there. But the second one has a lot of manipulations.

Specifically, in my case, it is not necessary to store what the user entered, i.e. there is no such need, i.e. to store in the state what the user entered, I think it will be superfluous.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Alexandrovich, 2019-03-09
@dollar1610

you answered your own question. Either pull data through js or by ref. But ref is not good in this situation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question