save a different value in the redux store than what is displayed on the frontend

49 Views Asked by At

I'm wondering if I can store a different value in the redux form FieldArray than what's displayed on the frontend.

Using the example from the docs: Each club has a club name and consists out of various members. I want to introduce another model called group which also consists out of at least one member.

I combine the firstName and lastName field to one field and let the user type in either the members individually OR the user can type in a group name which then fills in all members of that group but on the frontend, only the group name shows up, instead of each member name individually.

Currently, I allow this and then before I post the values to the server, I fetch the members of that group via a get request and then switch the group name for the member names.

I'm wondering if there is a more elegant (and faster) way to do this? I was looking at the parse method but it changes the value right away and doesn't let me display it how the user typed it in.

0

There are 0 best solutions below