S
S
symnoob2020-02-19 18:11:00
React
symnoob, 2020-02-19 18:11:00

Final-Form - React, how to create CRUD correctly?

Hello everyone,
I stumbled upon the Final-Form library for React. There are tons of examples, even how to create a form for the application's API. But since there is little experience with react, please help. In fact, I have one form. But it should work on creating new and processing old data. How in this case to hold out the DRY rules? Ie without repeating the form?
And the second question is not quite understood, is there a server-side validation? If yes, how to implement it? So that the data is sent to the Server, it is checked there, if everything is fine, then the server responds with a status of 200, if not, then I get the number of the status—error code and message to it. Here's how to display these messages on the form?
Thanks a lot, everyone

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2020-02-19
@hzzzzl

about the first - the form should not be interested in what data it receives - let, for example, its parent send it either an empty object or "old data" via props, and the parent receives the submit event from the form with a new filled object, which he (the parent) will send to the server either to save a new record or to edit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question