L
L
lexstile2021-01-22 22:55:40
React
lexstile, 2021-01-22 22:55:40

What is the easiest way to implement additional functionality for an existing input?

There is a set of fields of the following form:

<Input 
        name={`${namePrefix}.issuedBy`}
        placeholder='Кем выдан'
        defaultValue={get(defaultValue, 'issuedBy')}
      />


The bottom line is that it is necessary to implement additional functionality for the input in such a way that the current input is not affected inside, but logic is added to request the server to get the value when information is entered by the user, after which we could substitute the input in the value after the request .
The request method for each input will be different.

The question is how to properly organize the structure for this kind of task?
It would be cool if you could write it step by step. Thanks in advance.

PS I thought about HOC, but I don't quite understand how to connect it all together.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Bredikhin, 2021-01-25
@lexstile

It is unlikely that you need a wrapper component for this kind of task. You might want to use key-based dispatching.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question