react-final-form

React-Final-Form: Set initialValues from props, form state resets on props change

怎甘沉沦 提交于 2021-02-20 11:24:48
问题 I have a component, that takes a balance prop, and this balance prop can change over time. I then have a React Final Form to send a transaction, with usual fields amount to send, receiver... And in my validate , I just check that the user has enough balance to send the transaction. However, if my balance changes when the user is inputting something, then the whole form resets. How would you only reset part of the form state? See this codesandbox for an example: https://codesandbox.io/s

Conditional dropdowns with react-select and react-final-form field arrays

。_饼干妹妹 提交于 2021-02-17 06:28:25
问题 I'm using react-select with react-final-form and I need to have two selects, where the selected option in the first select dynamically sets the options for the second select. For example, when option One is selected in the first select, the second select gets options One A and One B. These selects are used in an array. Here is my codesandbox with initial setup https://codesandbox.io/s/react-final-form-field-arrays-e4mm6?fontsize=14. I've found two similar examples, but I don't know how to

Calling an async redux action creator on form submission

和自甴很熟 提交于 2021-02-11 06:36:26
问题 In a typical React/Redux app it's pretty common to use redux-thunk and async action creators to trigger an AJAX request and dispatch actions on start/success/failure of this request. However, I can't find a way to integrate such a function with react-final-form. Its redux submission example is using react-redux-promise-listener which dispatches an action immediately, but does not let me call my async action creator. It is possible to integrate react-final-form with a redux app that uses an

Providing initialValues for an array in final-form-arrays causes state changes to reset the whole form, how can i prevent this?

三世轮回 提交于 2021-02-07 19:23:58
问题 I have a form that uses final-form-arrays. The form works and validation works, however, when i make a state change inside the component, it resets all my values. I was able to replicate the issue with the same example that react-final-form-arrays provides: https://codesandbox.io/embed/react-final-form-field-arrays-om6p6 I added a button to toggle a state change. Essentially, just try filling values in the form, and then change the state. The form will reset, and i cant figure out why that is