So in my app I have the option to select and deselect multiple elements. What I want is to send the selected elements in array format along with some other elements in JSON format to my backend via the POST api.
For example :-
Let’s say there are 4 options A,B,C,D and the user selects (via clicking) C and D.
So I want the api request body to be something like :-
{
“name”: “username”,
“selected_options”: [
“C”,
“D”
]
}
Note that this is a part of a complete workflow and the post request will be send in the end.
Right now I’m storing the option data in the form of custom states, but I do not know how to convert it to an array or something similar.