'Rebinding the react html input values after API call

I am using two inputs with their respective buttons, whenever I click button1 of the input1 the API is called which returns the text that should be bind to second input, please suggest me the best approach using the react-redux.

const [text1, setText1] = React.useState<string>('');
const [text2, setText2] = React.useState<string>('');

above are the states for the input fields, whenever I click on the button, API call is fired which is async as we are using the redux saga to call the API.

dispatch(requestText2Data());

Above is an dispatch function which calls that redux saga which returns the data asynchronously. please help me with how and when I can bind that API returned data to the second input.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source